@@ -534,7 +534,7 @@ import { convertValueWithBaseRateToTargetRate } from './utils';
534
534
import * as currencyConverterSelectors from ' ./selectors' ;
535
535
import * as currencyRatesSelectors from ' ../currency-rates/selectors' ;
536
536
537
- const changeCurrencyEpic : Epic <Action , RootState > = (action$ , store ) =>
537
+ const recalculateTargetValueOnCurrencyChange : Epic <Action , RootState > = (action$ , store ) =>
538
538
action$ .ofType (
539
539
actionCreators .changeBaseCurrency .type ,
540
540
actionCreators .changeTargetCurrency .type ,
@@ -544,11 +544,10 @@ const changeCurrencyEpic: Epic<Action, RootState> = (action$, store) =>
544
544
currencyRatesSelectors .getBaseCurrencyRate (store .getState ()),
545
545
currencyRatesSelectors .getTargetCurrencyRate (store .getState ()),
546
546
);
547
-
548
- return actionCreators .changeTargetValue (value );
547
+ return actionCreators .recalculateTargetValue (value );
549
548
});
550
549
551
- const changeBaseValueEpic : Epic <Action , RootState > = (action$ , store ) =>
550
+ const recalculateTargetValueOnBaseValueChange : Epic <Action , RootState > = (action$ , store ) =>
552
551
action$ .ofType (
553
552
actionCreators .changeBaseValue .type ,
554
553
).map ((action : any ) => {
@@ -557,11 +556,10 @@ const changeBaseValueEpic: Epic<Action, RootState> = (action$, store) =>
557
556
currencyRatesSelectors .getBaseCurrencyRate (store .getState ()),
558
557
currencyRatesSelectors .getTargetCurrencyRate (store .getState ()),
559
558
);
560
-
561
- return actionCreators .changeTargetValue (value );
559
+ return actionCreators .recalculateTargetValue (value );
562
560
});
563
561
564
- const changeTargetValueEpic : Epic <Action , RootState > = (action$ , store ) =>
562
+ const recalculateBaseValueOnTargetValueChange : Epic <Action , RootState > = (action$ , store ) =>
565
563
action$ .ofType (
566
564
actionCreators .changeTargetValue .type ,
567
565
).map ((action : any ) => {
@@ -570,12 +568,13 @@ const changeTargetValueEpic: Epic<Action, RootState> = (action$, store) =>
570
568
currencyRatesSelectors .getTargetCurrencyRate (store .getState ()),
571
569
currencyRatesSelectors .getBaseCurrencyRate (store .getState ()),
572
570
);
573
-
574
- return actionCreators .changeBaseValue (value );
571
+ return actionCreators .recalculateBaseValue (value );
575
572
});
576
573
577
574
export const epics = combineEpics (
578
- changeCurrencyEpic , changeBaseValueEpic , changeTargetValueEpic ,
575
+ recalculateTargetValueOnCurrencyChange ,
576
+ recalculateTargetValueOnBaseValueChange ,
577
+ recalculateBaseValueOnTargetValueChange ,
579
578
);
580
579
```
581
580
0 commit comments