diff --git a/src/pages/index.js b/src/pages/index.js index f5eb45d..c60c8bf 100644 --- a/src/pages/index.js +++ b/src/pages/index.js @@ -9,8 +9,8 @@ const AdminLTE = // Maps the props that are going to be sended // to the component connected with Redux -const mapStateToProps = ({ walletInfo, bchBalance, bchWallet }) => { - return { walletInfo, bchBalance, bchWallet } +const mapStateToProps = ({ walletInfo, bchBalance, bchWallet, tokensInfo }) => { + return { walletInfo, bchBalance, bchWallet, tokensInfo } } // Send each action of the reducer as props @@ -19,7 +19,8 @@ const mapDispatchToProps = dispatch => { return { setWalletInfo: value => dispatch({ type: 'SET_WALLET_INFO', value }), updateBalance: value => dispatch({ type: 'UPDATE_BALANCE', value }), - setBchWallet: value => dispatch({ type: 'SET_BCH_WALLET', value }) + setBchWallet: value => dispatch({ type: 'SET_BCH_WALLET', value }), + setTokensInfo: value => dispatch({ type: 'SET_TOKENS_INFO', value }) } } diff --git a/src/redux/createStore.js b/src/redux/createStore.js index 8d36609..0ea96fc 100644 --- a/src/redux/createStore.js +++ b/src/redux/createStore.js @@ -47,6 +47,13 @@ const reducer = (state, action) => { }) } + // Get or update tokens information + if (action.type === 'SET_TOKENS_INFO') { + return Object.assign({}, state, { + tokensInfo: action.value + }) + } + return state } @@ -85,7 +92,8 @@ const instanceWallet = () => { const initialState = { walletInfo: localStorageInfo, // Object wallet info bchBalance: { bchBalance: 0, usdBalance: 0 }, // Wallet Balance - bchWallet: instanceWallet() // minimal-slp-wallet instance + bchWallet: instanceWallet(), // minimal-slp-wallet instance + tokensInfo: [] } const createStore = () => reduxCreateStore(reducer, initialState)