Skip to content

Commit

Permalink
fix currency rate api (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
domechn authored Oct 7, 2023
1 parent 4f74588 commit 768e0b3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/middlelayers/datafetch/currencies/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ export interface CurrencyRateQuerier {

export class ExchangeRate implements CurrencyRateQuerier {

private readonly queryUrl = "https://api.exchangerate.host/latest"
private readonly queryUrl = "https://currency-rate-api.domc.me/api/currency-rate/"
async listAllCurrencyRates(): Promise<CurrencyRate[]> {
const currentDate = new Date().toISOString().split('T')[0]
const resp = await sendHttpRequest<{
success: boolean,
base: string,
rates: {
[key: string]: number
}
}>("GET", this.queryUrl)
}>("GET", this.queryUrl + currentDate)
if (!resp.success) {
throw new Error("Failed to fetch currency rates")
}
Expand Down

0 comments on commit 768e0b3

Please sign in to comment.