summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/lib/backend.js6
-rw-r--r--app/redux/account/actions.js15
-rw-r--r--app/redux/account/reducers.js7
3 files changed, 14 insertions, 14 deletions
diff --git a/app/lib/backend.js b/app/lib/backend.js
index d36fc36d41..bc6eeeb8ff 100644
--- a/app/lib/backend.js
+++ b/app/lib/backend.js
@@ -214,11 +214,7 @@ export class Backend {
this._ipc.setAccount('')
.then(() => {
- this._store.dispatch(accountActions.loginChange({
- status: 'none',
- accountNumber: null,
- paidUntil: null,
- }));
+ this._store.dispatch(accountActions.loggedOut());
// disconnect user during logout
return this.disconnect()
diff --git a/app/redux/account/actions.js b/app/redux/account/actions.js
index 288e06e857..ea0d369125 100644
--- a/app/redux/account/actions.js
+++ b/app/redux/account/actions.js
@@ -1,7 +1,6 @@
// @flow
import type { Backend, BackendError } from '../../lib/backend';
-import type { AccountReduxState } from './reducers.js';
type StartLoginAction = {
type: 'START_LOGIN',
@@ -16,15 +15,14 @@ type LoginFailedAction = {
error: BackendError,
};
-type LoginChangeAction = {
- type:'LOGIN_CHANGE',
- newData: $Shape<AccountReduxState>,
+type LoggedOutAction = {
+ type: 'LOGGED_OUT',
};
export type AccountAction = StartLoginAction
| LoginSuccessfulAction
| LoginFailedAction
- | LoginChangeAction;
+ | LoggedOutAction;
function startLogin(accountNumber?: string): StartLoginAction {
return {
@@ -47,14 +45,13 @@ function loginFailed(error: BackendError): LoginFailedAction {
};
}
-function loginChange(data: $Shape<AccountReduxState>): LoginChangeAction {
+function loggedOut(): LoggedOutAction {
return {
- type: 'LOGIN_CHANGE',
- newData: data,
+ type: 'LOGGED_OUT',
};
}
const login = (backend: Backend, account: string) => () => backend.login(account);
const logout = (backend: Backend) => () => backend.logout();
-export default { login, logout, loginChange, startLogin, loginSuccessful, loginFailed };
+export default { login, logout, startLogin, loginSuccessful, loginFailed, loggedOut };
diff --git a/app/redux/account/reducers.js b/app/redux/account/reducers.js
index dc2c985285..d6458e20dd 100644
--- a/app/redux/account/reducers.js
+++ b/app/redux/account/reducers.js
@@ -41,6 +41,13 @@ export default function(state: AccountReduxState = initialState, action: ReduxAc
accountNumber: null,
error: action.error,
}};
+ case 'LOGGED_OUT':
+ return { ...state, ...{
+ status: 'none',
+ accountNumber: null,
+ paidUntil: null,
+ error: null,
+ }};
}
return state;