Skip to content

Open source personal finance application

fix(currencies): correct return type in getRatesOfUSD function

Ilya Komichev3e7f1c2e9865
diff --git a/app/components/currencies/useCurrenciesStore.ts b/app/components/currencies/useCurrenciesStore.ts
index 667f0586..1b565677 100644
--- a/app/components/currencies/useCurrenciesStore.ts
+++ b/app/components/currencies/useCurrenciesStore.ts
@@ -21,11 +21,11 @@ export const useCurrenciesStore = defineStore('currencies', () => {
async function getRatesOfUSD(apiKey: string) {
try {
- const { data } = await useAsyncData<Rates>(
+ const { data } = await useAsyncData<{ rates: Rates }>(
'rates',
() => $fetch(`${serviceUrlBase}${apiKey}`),
)
- return data.value
+ return data.value?.rates
}
catch (e) {
console.error('Currencies api are unavailable', e)