This file contains hidden or 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
| import axios from 'axios'; | |
| const getCountries = async (currencyCode) => { | |
| try { | |
| const response = await axios.get(`https://restcountries.com/v3.1/currency/${currencyCode}`); | |
| return response.data.map(country => country.name.common); | |
| } catch (error) { | |
| throw new Error(`Unable to get countries that use ${currencyCode}`); | |
| } |