1
0
mirror of https://github.com/aclindsa/moneygo.git synced 2025-07-02 04:18:38 -04:00

Initial plumbing for moving to Redux

This commit is contained in:
2016-10-03 19:49:15 -04:00
parent 449b4ee760
commit 4f2f15783a
9 changed files with 304 additions and 2 deletions

View File

@ -0,0 +1,20 @@
var AccountConstants = require('../constants/AccountConstants');
module.exports = function(state = -1, action) {
switch (action.type) {
case AccountConstants.ACCOUNTS_FETCHED:
for (var i = 0; i < action.accounts.length; i++) {
if (action.accounts[i].AccountId == state)
return state;
}
return -1;
case AccountConstants.ACCOUNT_REMOVED:
if (action.accountId == state)
return -1;
return state;
case AccountConstants.ACCOUNT_SELECTED:
return action.accountId;
default:
return state;
}
};