Created
May 17, 2020 19:40
-
-
Save clintonyeb/71b85b430d1f7c5075ebb0d30dfb5158 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//called from CurrencyCardDisplay component calls GET_CURRENCY_PAIR currencyReducer | |
export const fetchCurrency = () => dispatch => { | |
dispatch({type: 'INIT_GET_CURRENCY_NAME_REQUEST'}) | |
fetch('https://restsimulator.coderiq.io/currency_pairs') | |
.then(function(response) { | |
return response.json(); | |
}) | |
.then(function(currencyJSON) { | |
console.log(JSON.stringify(currencyJSON)); | |
dispatch({ | |
type: "GET_CURRENCY_PAIR", | |
payload: currencyJSON | |
}) | |
}); | |
} | |
//called from CurrencyCardDisplay component calls COUNTRY_CHANGE currencyReducer | |
export const changeCurrency = (countryCode, index) => dispatch => { | |
dispatch({ | |
type: 'COUNTRY_CHANGE', | |
code: countryCode, | |
cardPosition: index | |
}) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment