summaryrefslogtreecommitdiffhomepage
path: root/app
diff options
context:
space:
mode:
authorErik Larkö <erik@mullvad.net>2017-08-08 09:30:57 +0200
committerErik Larkö <erik@mullvad.net>2017-08-08 09:30:57 +0200
commitd375be8e56975d57f1ca67f28459609de6c10fa5 (patch)
treee753fa4cfefb8e0a5a3152e7a6282daaa31285ae /app
parent9a2471a20b6e386d620ac234b61e9e501b99df2b (diff)
parent490061c472765ea68feb9450e12a506019ea44b4 (diff)
downloadmullvadvpn-d375be8e56975d57f1ca67f28459609de6c10fa5.tar.xz
mullvadvpn-d375be8e56975d57f1ca67f28459609de6c10fa5.zip
Merge branch 'logged-out-action'
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;