Redux: Add partOneComplete actions/action creators/reducers.
This commit is contained in:
parent
a277134bc4
commit
2eab0082a6
|
@ -3,7 +3,8 @@ import {
|
|||
SWAP_DESTINATION_KIND,
|
||||
SWAP_ORIGIN_AMOUNT,
|
||||
SWAP_ORIGIN_KIND,
|
||||
SWAP_UPDATE_BITY_RATES
|
||||
SWAP_UPDATE_BITY_RATES,
|
||||
SWAP_PART_ONE_COMPLETE
|
||||
} from './swapConstants';
|
||||
|
||||
export const originKindSwap = value => {
|
||||
|
@ -40,3 +41,10 @@ export const updateBityRatesSwap = value => {
|
|||
value
|
||||
};
|
||||
};
|
||||
|
||||
export const partOneCompleteSwap = (value: boolean) => {
|
||||
return {
|
||||
type: SWAP_PART_ONE_COMPLETE,
|
||||
value
|
||||
};
|
||||
};
|
||||
|
|
|
@ -3,3 +3,4 @@ export const SWAP_DESTINATION_KIND = 'SWAP_DESTINATION_KIND';
|
|||
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';
|
||||
|
|
|
@ -3,15 +3,16 @@ import {
|
|||
SWAP_DESTINATION_KIND,
|
||||
SWAP_ORIGIN_AMOUNT,
|
||||
SWAP_ORIGIN_KIND,
|
||||
SWAP_UPDATE_BITY_RATES
|
||||
SWAP_UPDATE_BITY_RATES,
|
||||
SWAP_PART_ONE_COMPLETE
|
||||
} from 'actions/swapConstants';
|
||||
import { combineAndUpper } from 'api/bity';
|
||||
|
||||
export const ALL_CRYPTO_KIND_OPTIONS = ['BTC', 'ETH', 'REP'];
|
||||
|
||||
const initialState = {
|
||||
originAmount: 0,
|
||||
destinationAmount: 0,
|
||||
originAmount: '',
|
||||
destinationAmount: '',
|
||||
originKind: 'BTC',
|
||||
destinationKind: 'ETH',
|
||||
destinationKindOptions: ALL_CRYPTO_KIND_OPTIONS.filter(
|
||||
|
@ -20,6 +21,7 @@ const initialState = {
|
|||
originKindOptions: ALL_CRYPTO_KIND_OPTIONS.filter(
|
||||
element => element !== 'REP'
|
||||
),
|
||||
partOneComplete: false,
|
||||
bityRates: {}
|
||||
};
|
||||
|
||||
|
@ -94,6 +96,11 @@ export function swap(state = initialState, action) {
|
|||
...action.value
|
||||
}
|
||||
};
|
||||
case SWAP_PART_ONE_COMPLETE:
|
||||
return {
|
||||
...state,
|
||||
partOneComplete: action.value
|
||||
};
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue