-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.vue
27 lines (24 loc) · 811 Bytes
/
app.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<script lang="ts" setup>
import { storeToRefs } from 'pinia';
const covidCasesStore = useCovidCasesStore()
const { globalCases } = storeToRefs(covidCasesStore)
const geojsonStore = useGeojsonStore()
if (!globalCases.value.length) {
try {
const [globalCasesRes, geojsonRes, countriesRes] = await Promise.all([
useFetch('/api/global-total-case'), useFetch('/api/geojson/countries'), useLazyFetch('/api/countries')
])
covidCasesStore.setGlobalCases(globalCasesRes.data.value || [])
geojsonStore.setGeoJSONCountries(geojsonRes.data.value || {})
covidCasesStore.setCountriesList(countriesRes.data?.value || [])
} catch (error) {
console.error(error)
}
}
</script>
<template>
<div>
<!-- Markup shared across all pages, ex: NavBar -->
<NuxtPage />
</div>
</template>