mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-21 08:28:51 +00:00
d19c4f44e6
* Initial attempt at webpack 4 upgrade, still not working. * Remove unused modules, update some more packages. * Wrangle types due to webpack weirdness. * Undefined function * Package updates. * Replace extract text plugin. Re-add unusable code, but comment it out. * Fix uglification * Remove custom uglify, disable concatenateModules * Upgrade and reenable favicons. Get rid of CSS warning. * Fix up tscheck * Add webpack modes to freezer, electron. * Uodate webpack dev middleware
43 lines
1.0 KiB
TypeScript
43 lines
1.0 KiB
TypeScript
import {
|
|
ChangeNodeAction,
|
|
ChangeNodeIntentAction,
|
|
NodeAction,
|
|
TypeKeys,
|
|
RemoveCustomNodeAction,
|
|
CustomNodeAction
|
|
} from 'actions/config';
|
|
import { SelectedNodeState as State } from './types';
|
|
|
|
export const INITIAL_STATE: State = {
|
|
nodeId: 'eth_mycrypto',
|
|
pending: false
|
|
};
|
|
|
|
const changeNode = (_: State, { payload }: ChangeNodeAction): State => ({
|
|
nodeId: payload.nodeId,
|
|
pending: false
|
|
});
|
|
|
|
const changeNodeIntent = (state: State, _: ChangeNodeIntentAction): State => ({
|
|
...state,
|
|
pending: true
|
|
});
|
|
|
|
const handleRemoveCustomNode = (_: State, _1: RemoveCustomNodeAction): State => INITIAL_STATE;
|
|
|
|
export const selectedNode = (
|
|
state: State = INITIAL_STATE,
|
|
action: NodeAction | CustomNodeAction
|
|
) => {
|
|
switch (action.type) {
|
|
case TypeKeys.CONFIG_NODE_CHANGE:
|
|
return changeNode(state, action);
|
|
case TypeKeys.CONFIG_NODE_CHANGE_INTENT:
|
|
return changeNodeIntent(state, action);
|
|
case TypeKeys.CONFIG_REMOVE_CUSTOM_NODE:
|
|
return handleRemoveCustomNode(state, action);
|
|
default:
|
|
return state;
|
|
}
|
|
};
|