Answer the question
In order to leave comments, you need to log in
Why are there no errors in vue 3 despite different data types on asynchronous request?
1. Interface file
export interface CategoriesInterface {
base: number,
date: string,
rates: {
[key: string]: number
},
success: boolean,
timestamp: number
}
<script lang="ts">
import { ref, onMounted } from 'vue'
import { CategoriesInterface } from '@/interface/currency-interface'
export default {
name: 'Home',
const currency = ref<CategoriesInterface | null>(null)
onMounted(async () => {
currency.value = await store.dispatch('fetchCurrency')
})
}
</script>
{
base: 'EUR',
date: '2022-03-27',
rates: {
EUR: 1,
RUB: 112,
USD: 1
},
success: true,
timestamp: 1648371543
}
********
actions: {
async fetchCurrency() {
const { data } = await axios(`http://ссылка`)
return data
}
}
************
Answer the question
In order to leave comments, you need to log in
I assume that the return type of the fetchCurrency function is any.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question