diff --git a/src/reducers/SendFormReducer.js b/src/reducers/SendFormEthereumReducer.js similarity index 94% rename from src/reducers/SendFormReducer.js rename to src/reducers/SendFormEthereumReducer.js index b370be6e..5053f673 100644 --- a/src/reducers/SendFormReducer.js +++ b/src/reducers/SendFormEthereumReducer.js @@ -75,16 +75,15 @@ export const initialState: State = { }; export default (state: State = initialState, action: Action): State => { + if (action.type === ACCOUNT.DISPOSE) return initialState; + if (!action.networkType || action.networkType !== 'ethereum') return state; + switch (action.type) { case SEND.INIT: case SEND.CHANGE: case SEND.VALIDATION: return action.state; - case ACCOUNT.DISPOSE: - return initialState; - - case SEND.TOGGLE_ADVANCED: return { ...state, diff --git a/src/reducers/RippleSendFormReducer.js b/src/reducers/SendFormRippleReducer.js similarity index 89% rename from src/reducers/RippleSendFormReducer.js rename to src/reducers/SendFormRippleReducer.js index 2426cf62..90af5cac 100644 --- a/src/reducers/RippleSendFormReducer.js +++ b/src/reducers/SendFormRippleReducer.js @@ -38,13 +38,11 @@ export type State = { export const initialState: State = { networkName: '', networkSymbol: '', - currency: '', advanced: false, untouched: true, touched: {}, address: '', - //address: '0x574BbB36871bA6b78E27f4B4dCFb76eA0091880B', amount: '', setMax: false, feeLevels: [], @@ -55,23 +53,23 @@ export const initialState: State = { }, sequence: '0', total: '0', - sending: false, + errors: {}, warnings: {}, infos: {}, + + sending: false, }; export default (state: State = initialState, action: Action): State => { + if (action.type === ACCOUNT.DISPOSE) return initialState; + if (!action.networkType || action.networkType !== 'ripple') return state; + switch (action.type) { case SEND.INIT: case SEND.CHANGE: case SEND.VALIDATION: - // return action.state; - return state; - - case ACCOUNT.DISPOSE: - return initialState; - + return action.state; case SEND.TOGGLE_ADVANCED: return { diff --git a/src/reducers/index.js b/src/reducers/index.js index 3225fc15..498e5a70 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -10,8 +10,8 @@ import modal from 'reducers/ModalReducer'; import web3 from 'reducers/Web3Reducer'; import accounts from 'reducers/AccountsReducer'; import selectedAccount from 'reducers/SelectedAccountReducer'; -import sendForm from 'reducers/SendFormReducer'; -import rippleSendForm from 'reducers/RippleSendFormReducer'; +import sendFormEthereum from 'reducers/SendFormEthereumReducer'; +import sendFormRipple from 'reducers/SendFormRippleReducer'; import receive from 'reducers/ReceiveReducer'; import summary from 'reducers/SummaryReducer'; import tokens from 'reducers/TokensReducer'; @@ -33,8 +33,8 @@ const reducers = { web3, accounts, selectedAccount, - sendForm, - rippleSendForm, + sendFormEthereum, + sendFormRipple, receive, summary, tokens,