Skip to content

Commit

Permalink
update exchange api headers
Browse files Browse the repository at this point in the history
  • Loading branch information
anh-chu committed Sep 25, 2023
1 parent 1a93e09 commit 3a0b62e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/util/currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,13 @@ async function getExchangeRates() {
if ((await chrome.storage.local.get("exchangeRate"))?.exchangeRateDate) {
return (await chrome.storage.local.get("exchangeRate"))?.rates;
}
const url = `https://api.apilayer.com/fixer/latest?symbols=USD,EUR,VND&access_key=${accessKey}`;
const r = await fetch(url);
const url = `https://api.apilayer.com/fixer/latest?symbols=USD,EUR,VND`;
const headers = {
apikey: accessKey,
};
const r = await fetch(url, {
headers: headers,
});
const j = await r.json();
chrome.storage.local.set({
exchangeRate: { rates: j, exchangeRateDate: Date.now() },
Expand Down

0 comments on commit 3a0b62e

Please sign in to comment.