Untitled

mail@pastecode.io avatar
unknown
plain_text
7 months ago
496 B
8
Indexable
Never
const api = 'https://economia.awesomeapi.com.br/json/all';

export const getCurrency = async () => {
  try {
    const response = await fetch(api);
    const data = await response.json();
    return data;
  } catch (error) {
    console.log(error);
  }
};

export const getCurrencyName = async () => {
  try {
    const data = await getCurrency();
    const currencies = Object.keys(data).filter((key) => key !== 'USDT');
    return currencies;
  } catch (error) {
    console.log(error);
  }
};