mirror of https://github.com/trezor/trezor-wallet
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
907 B
47 lines
907 B
/* @flow */
|
|
'use strict';
|
|
|
|
import * as STORAGE from '../actions/constants/LocalStorage';
|
|
|
|
type State = {
|
|
initialized: boolean;
|
|
error: any;
|
|
config: any;
|
|
ERC20Abi: any;
|
|
tokens: any;
|
|
}
|
|
|
|
const initialState: State = {
|
|
initialized: false,
|
|
error: null,
|
|
config: null,
|
|
ERC20Abi: null,
|
|
tokens: null,
|
|
};
|
|
|
|
export default function localStorage(state: State = initialState, action: any): any {
|
|
|
|
switch (action.type) {
|
|
|
|
case STORAGE.READY :
|
|
return {
|
|
...state,
|
|
initialized: true,
|
|
config: action.config,
|
|
ERC20Abi: action.ERC20Abi,
|
|
tokens: action.tokens,
|
|
error: null
|
|
}
|
|
|
|
case STORAGE.ERROR :
|
|
return {
|
|
...state,
|
|
error: action.error
|
|
}
|
|
|
|
|
|
default:
|
|
return state;
|
|
}
|
|
|
|
} |