mirror of
https://github.com/trezor/trezor-wallet
synced 2025-07-03 13:22:35 +00:00
47 lines
907 B
JavaScript
47 lines
907 B
JavaScript
/* @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;
|
|
}
|
|
|
|
} |