mirror of
https://github.com/status-im/MyCrypto.git
synced 2025-01-30 04:44:56 +00:00
Fix custom node removal crashing app
This commit is contained in:
parent
be88aaabb0
commit
f7a9162279
@ -1,4 +1,11 @@
|
|||||||
import { ChangeNodeAction, ChangeNodeIntentAction, NodeAction, TypeKeys } from 'actions/config';
|
import {
|
||||||
|
ChangeNodeAction,
|
||||||
|
ChangeNodeIntentAction,
|
||||||
|
NodeAction,
|
||||||
|
TypeKeys,
|
||||||
|
RemoveCustomNodeAction,
|
||||||
|
CustomNodeAction
|
||||||
|
} from 'actions/config';
|
||||||
|
|
||||||
interface NodeLoaded {
|
interface NodeLoaded {
|
||||||
pending: false;
|
pending: false;
|
||||||
@ -27,12 +34,19 @@ const changeNodeIntent = (state: State, _: ChangeNodeIntentAction): State => ({
|
|||||||
pending: true
|
pending: true
|
||||||
});
|
});
|
||||||
|
|
||||||
export const selectedNode = (state: State = INITIAL_STATE, action: NodeAction) => {
|
const handleRemoveCustomNode = (state: State, _: RemoveCustomNodeAction): State => INITIAL_STATE;
|
||||||
|
|
||||||
|
export const selectedNode = (
|
||||||
|
state: State = INITIAL_STATE,
|
||||||
|
action: NodeAction | CustomNodeAction
|
||||||
|
) => {
|
||||||
switch (action.type) {
|
switch (action.type) {
|
||||||
case TypeKeys.CONFIG_NODE_CHANGE:
|
case TypeKeys.CONFIG_NODE_CHANGE:
|
||||||
return changeNode(state, action);
|
return changeNode(state, action);
|
||||||
case TypeKeys.CONFIG_NODE_CHANGE_INTENT:
|
case TypeKeys.CONFIG_NODE_CHANGE_INTENT:
|
||||||
return changeNodeIntent(state, action);
|
return changeNodeIntent(state, action);
|
||||||
|
case TypeKeys.CONFIG_REMOVE_CUSTOM_NODE:
|
||||||
|
return handleRemoveCustomNode(state, action);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user