mirror of
https://github.com/aclindsa/moneygo.git
synced 2025-07-02 04:18:38 -04:00
Add initial UI for user-editable securities
This commit is contained in:
23
js/reducers/SelectedSecurityReducer.js
Normal file
23
js/reducers/SelectedSecurityReducer.js
Normal file
@ -0,0 +1,23 @@
|
||||
var SecurityConstants = require('../constants/SecurityConstants');
|
||||
var UserConstants = require('../constants/UserConstants');
|
||||
|
||||
module.exports = function(state = -1, action) {
|
||||
switch (action.type) {
|
||||
case SecurityConstants.SECURITIES_FETCHED:
|
||||
for (var i = 0; i < action.securities.length; i++) {
|
||||
if (action.securities[i].SecurityId == state)
|
||||
return state;
|
||||
}
|
||||
return -1;
|
||||
case SecurityConstants.SECURITY_REMOVED:
|
||||
if (action.securityId == state)
|
||||
return -1;
|
||||
return state;
|
||||
case SecurityConstants.SECURITY_SELECTED:
|
||||
return action.securityId;
|
||||
case UserConstants.USER_LOGGEDOUT:
|
||||
return -1;
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
Reference in New Issue
Block a user