#48: reset accounts state on logout

This commit is contained in:
SleepWalker
2016-11-14 07:28:25 +02:00
parent b6b8468904
commit 9e7d5b8338
6 changed files with 50 additions and 4 deletions

View File

@@ -1,4 +1,4 @@
import { ADD, REMOVE, ACTIVATE, UPDATE_TOKEN } from './actions';
import { ADD, REMOVE, ACTIVATE, RESET, UPDATE_TOKEN } from './actions';
/**
* @typedef {AccountsState}
@@ -50,6 +50,9 @@ export default function accounts(
active: payload
};
case RESET:
return accounts(undefined, {});
case REMOVE:
if (!payload || !payload.id) {
throw new Error('Invalid or empty payload passed for accounts.remove');