mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-02-08 09:13:41 +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
30 lines
818 B
TypeScript
30 lines
818 B
TypeScript
import {
|
|
TypeKeys,
|
|
CustomNodeAction,
|
|
AddCustomNodeAction,
|
|
RemoveCustomNodeAction
|
|
} from 'actions/config';
|
|
import { CustomNodesState as State } from './types';
|
|
|
|
const addCustomNode = (state: State, { payload }: AddCustomNodeAction): State => ({
|
|
...state,
|
|
[payload.id]: payload.config
|
|
});
|
|
|
|
function removeCustomNode(state: State, { payload }: RemoveCustomNodeAction): State {
|
|
const stateCopy = { ...state };
|
|
Reflect.deleteProperty(stateCopy, payload.id);
|
|
return stateCopy;
|
|
}
|
|
|
|
export const customNodes = (state: State = {}, action: CustomNodeAction): State => {
|
|
switch (action.type) {
|
|
case TypeKeys.CONFIG_ADD_CUSTOM_NODE:
|
|
return addCustomNode(state, action);
|
|
case TypeKeys.CONFIG_REMOVE_CUSTOM_NODE:
|
|
return removeCustomNode(state, action);
|
|
default:
|
|
return state;
|
|
}
|
|
};
|