diff --git a/src/data/currencies.ts b/src/data/currencies.ts index 59273c7..c7a78e7 100644 --- a/src/data/currencies.ts +++ b/src/data/currencies.ts @@ -15,8 +15,6 @@ export default [ { name: 'Swiss franc', code: 'CHF' }, { name: 'Icelandic krona', code: 'ISK', symbol: '‎kr' }, { name: 'Norwegian krone', code: 'NOK', symbol: 'øre' }, - { name: 'Croatian kuna', code: 'HRK', symbol: 'kn' }, - { name: 'Russian rouble', code: 'RUB' }, { name: 'Turkish lira', code: 'TRY' }, { name: 'Australian dollar', code: 'AUD', symbol: 'A$' }, { name: 'Brazilian real', code: 'BRL', symbol: 'R$' }, diff --git a/src/services/ExchangeService.ts b/src/services/ExchangeService.ts index 40b294e..df1acbc 100644 --- a/src/services/ExchangeService.ts +++ b/src/services/ExchangeService.ts @@ -3,7 +3,7 @@ import couchService from '@/services/CouchService' import formatDate from '@/utils/format-date' class ExchangeService { - private baseUrl: string = 'https://api.exchangeratesapi.io/' + private baseUrl: string = 'https://api.frankfurter.dev/v1/' /** * Get an exchange with defined date and desired currencies @@ -42,12 +42,16 @@ class ExchangeService { } } } else { - const url = new URL( - date ? `${this.baseUrl}${formattedDate}` : 'latest' - ) + const url = new URL(`${this.baseUrl}${date ? formattedDate : 'latest'}`) if (base) { url.searchParams.append('base', base) } + if (rates.length) { + url.searchParams.append( + 'symbols', + rates.filter((r) => r !== base).join(',') + ) + } const response = await fetch(url.toString()) if (response.ok) { exchange = await response.json()