assembly/composables/protocols/useUniverseOverview.ts

32 lines
612 B
TypeScript
Raw Normal View History

2021-12-03 08:45:02 +00:00
import { onMounted, ref, useContext } from '@nuxtjs/composition-api';
const overview = ref<OverviewModel>({
tvl: 0, totalProfits: 0, totalGasSaved: 0
});
type OverviewModel = {
tvl: number
totalProfits: number
totalGasSaved: number
}
export function useUniverseOverview() {
const { $axios } = useContext();
const fetchOverview = async () => {
const { data } = await $axios
2021-12-03 09:13:18 +00:00
.$get<{ data: OverviewModel }>("https://api.webwxk.com/singleVault/universe/instadapp/overview")
2021-12-03 08:45:02 +00:00
overview.value = data;
};
onMounted(() => {
fetchOverview();
});
return {
overview
};
}