Skip to content

Commit

Permalink
♻️ Refactor service and skip coverage before enabling BTC
Browse files Browse the repository at this point in the history
  • Loading branch information
massao committed May 16, 2019
1 parent 720f0a9 commit 5e3991c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/actions/service.js
Expand Up @@ -5,23 +5,27 @@ import { errorToastDisplayed } from './toaster';
import { tokenMap } from '../constants/tokens';

export const pricesRetrieved = () => (dispatch, getState) => {
const { settings: { token } } = getState();
const { settings: { token } } = getState()
// istanbul ignore next
const activeToken = localStorage.getItem('btc') ? token.active : tokenMap.LSK.key; // TODO: Refactor after enabling BTC

serviceAPI.getPriceTicker((token && token.active) || tokenMap.LSK.key)
serviceAPI.getPriceTicker(activeToken)
.then(priceTicker => dispatch({
type: actionTypes.pricesRetrieved,
data: {
priceTicker,
activeToken: token ? token.active : tokenMap.LSK.key,
activeToken,
},
}))
.catch(() => dispatch(errorToastDisplayed(i18next.t('Error retrieving convertion rates.'))));
};

export const dynamicFeesRetrieved = () => (dispatch, getState) => {
const { settings: { token } } = getState();
// istanbul ignore next
const activeToken = localStorage.getItem('btc') ? token.active : tokenMap.LSK.key; // TODO: Refactor after enabling BTC

serviceAPI.getDynamicFees((token && token.active) || tokenMap.LSK.key)
serviceAPI.getDynamicFees(activeToken)
.then(dynamicFees => dispatch({
type: actionTypes.dynamicFeesRetrieved,
dynamicFees,
Expand Down

0 comments on commit 5e3991c

Please sign in to comment.