Redux: Add SWAP_RECEIVING_ADDRESS action creators/reducers.

This commit is contained in:
Daniel Ternyak 2017-06-24 01:08:33 -05:00
parent cb36331c2d
commit bc9765d99b
3 changed files with 19 additions and 3 deletions

View File

@ -4,7 +4,8 @@ import {
SWAP_ORIGIN_AMOUNT,
SWAP_ORIGIN_KIND,
SWAP_UPDATE_BITY_RATES,
SWAP_PART_ONE_COMPLETE
SWAP_PART_ONE_COMPLETE,
SWAP_RECEIVING_ADDRESS
} from './swapConstants';
export const originKindSwap = value => {
@ -48,3 +49,10 @@ export const partOneCompleteSwap = (value: boolean) => {
value
};
};
export const receivingAddressSwap = value => {
return {
type: SWAP_RECEIVING_ADDRESS,
value
};
};

View File

@ -4,3 +4,4 @@ export const SWAP_ORIGIN_AMOUNT = 'SWAP_ORIGIN_AMOUNT';
export const SWAP_DESTINATION_AMOUNT = 'SWAP_DESTINATION_AMOUNT';
export const SWAP_UPDATE_BITY_RATES = 'SWAP_UPDATE_BITY_RATES';
export const SWAP_PART_ONE_COMPLETE = 'SWAP_PART_ONE_COMPLETE';
export const SWAP_RECEIVING_ADDRESS = 'SWAP_RECEIVING_ADDRESS';

View File

@ -4,7 +4,8 @@ import {
SWAP_ORIGIN_AMOUNT,
SWAP_ORIGIN_KIND,
SWAP_UPDATE_BITY_RATES,
SWAP_PART_ONE_COMPLETE
SWAP_PART_ONE_COMPLETE,
SWAP_RECEIVING_ADDRESS
} from 'actions/swapConstants';
import { combineAndUpper } from 'api/bity';
@ -22,7 +23,8 @@ const initialState = {
element => element !== 'REP'
),
partOneComplete: false,
bityRates: {}
bityRates: {},
receivingAddress: ''
};
const buildDestinationAmount = (
@ -101,6 +103,11 @@ export function swap(state = initialState, action) {
...state,
partOneComplete: action.value
};
case SWAP_RECEIVING_ADDRESS:
return {
...state,
receivingAddress: action.value
};
default:
return state;
}