Browse Source

refactored reducers

all-modes
pbca26 8 years ago
parent
commit
5a9005904c
  1. 5
      react/src/reducers/addcoin.js
  2. 5
      react/src/reducers/atomic.js
  3. 10
      react/src/reducers/interval.js
  4. 20
      react/src/reducers/main.js
  5. 30
      react/src/reducers/settings.js
  6. 10
      react/src/reducers/syncOnly.js

5
react/src/reducers/addcoin.js

@ -8,10 +8,11 @@ export function AddCoin(state = {
}, action) {
switch (action.type) {
case DISPLAY_ADDCOIN_MODAL:
return Object.assign({}, state, {
return {
...state,
display: action.display,
isLogin: action.isLogin,
});
};
default:
return state;
}

5
react/src/reducers/atomic.js

@ -7,9 +7,10 @@ export function Atomic(state = {
}, action) {
switch (action.type) {
case ATOMIC:
return Object.assign({}, state, {
return {
...state,
response: action.response,
});
};
default:
return state;
}

10
react/src/reducers/interval.js

@ -12,15 +12,17 @@ export function Interval(state = {
case START_INTERVAL:
newIntervalState[action.name] = action.handle;
return Object.assign({}, state, {
return {
...state,
interval: newIntervalState,
});
};
case STOP_INTERVAL:
newIntervalState[action.name] = null;
return Object.assign({}, state, {
return {
...state,
interval: newIntervalState,
});
};
default:
return state;
}

20
react/src/reducers/main.js

@ -12,23 +12,27 @@ export function Main(state = {
}, action) {
switch (action.type) {
case GET_ACTIVE_COINS:
return Object.assign({}, state, {
return {
...state,
activeCoins: action.activeCoins,
coins: action.coins,
});
};
case LOGIN:
return Object.assign({}, state, {
return {
...state,
isLoggedIn: action.isLoggedIn,
});
};
case ACTIVE_HANDLE:
return Object.assign({}, state, {
return {
...state,
isLoggedIn: action.isLoggedIn,
activeHandle: action.handle,
});
};
case DISPLAY_LOGIN_SETTINGS_MODAL:
return Object.assign({}, state, {
return {
...state,
displayLoginSettingsModal: action.displayLoginSettingsModal,
});
};
default:
return state;
}

30
react/src/reducers/settings.js

@ -17,31 +17,37 @@ export function Settings(state = {
}, action) {
switch (action.type) {
case GET_WIF_KEY:
return Object.assign({}, state, {
return {
...state,
wifkey: action.wifkey,
address: action.address,
});
};
case GET_PEERS_LIST:
return Object.assign({}, state, {
return {
...state,
supernetPeers: action.supernetPeers,
rawPeers: action.rawPeers,
});
};
case GET_DEBUG_LOG:
return Object.assign({}, state, {
return {
...state,
debugLog: action.data,
});
};
case LOAD_APP_CONFIG:
return Object.assign({}, state, {
return {
...state,
appSettings: action.config,
});
};
case LOAD_APP_INFO:
return Object.assign({}, state, {
return {
...state,
appInfo: action.info,
});
};
case CLI:
return Object.assign({}, state, {
return {
...state,
cli: action.data,
});
};
default:
return state;
}

10
react/src/reducers/syncOnly.js

@ -9,13 +9,15 @@ export function SyncOnly(state = {
}, action) {
switch (action.type) {
case SYNC_ONLY_MODAL_TOGGLE:
return Object.assign({}, state, {
return {
...state,
display: action.display,
});
};
case SYNC_ONLY_DATA:
return Object.assign({}, state, {
return {
...state,
forks: action.forks,
});
};
default:
return state;
}

Loading…
Cancel
Save