mahee-auffret/composables/useFetchGlobalData.js

11 lines
272 B
JavaScript

export const useFetchGlobalData = async () => {
const globalData = useState('globalData', () => {})
await callOnce(async () => {
globalData.value = await $fetch(`/api/items/global`)
globalData.value = globalData.value.data
})
return {
globalData
}
}