James Prado aabcd3f7a3 Use Network Symbol in Confirmation Modal (#1039)
* Set default unit to 'ETH' instead of 'ether'

* Use 'isEtherUnit()' everywhere

* Set default unit to empty string

* Update isEthUnit to isNetworkUnit

* Fix unit conversion for non-ethereum networks

* Set default network unit properly

* Fix tests

* fix typos

* Update isNetworkUnit selector

* Update isNetworkUnit

* Fix validationhelpers tests

* Add mock state to tests & Move isNetworkUnit to selectors

* Fix validation helper spec

* fix unit swap spec
2018-03-01 19:24:14 -06:00

23 lines
704 B
TypeScript

import { SagaIterator } from 'redux-saga';
import { TypeKeys } from 'actions/wallet';
import { takeEvery, put, select } from 'redux-saga/effects';
import {
reset as resetActionCreator,
setUnitMeta,
TypeKeys as Constants
} from 'actions/transaction';
import { getNetworkUnit } from 'selectors/config';
export function* resetTransactionState(): SagaIterator {
yield put(resetActionCreator());
}
export function* setNetworkUnit(): SagaIterator {
const networkUnit = yield select(getNetworkUnit);
yield put(setUnitMeta(networkUnit));
}
export const setDefaultUnit = takeEvery(Constants.RESET, setNetworkUnit);
export const reset = [takeEvery([TypeKeys.WALLET_RESET], resetTransactionState)];