phongdt:header footer
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
import { defineStore, acceptHMRUpdate } from 'pinia'
|
||||
|
||||
export const useNavigationStoreV2 = defineStore('navigation-v2', () => {
|
||||
const topMenu = ref('')
|
||||
|
||||
async function fetchNavigation() {
|
||||
const {data, error } = await useFetch('/api/services/navigation')
|
||||
|
||||
if (error.value) {
|
||||
return ''
|
||||
}
|
||||
if(data.value) {
|
||||
topMenu.value = data.value
|
||||
}
|
||||
|
||||
return topMenu.value
|
||||
}
|
||||
|
||||
return {topMenu, fetchNavigation}
|
||||
})
|
||||
|
||||
if (import.meta.hot) {
|
||||
import.meta.hot.accept(acceptHMRUpdate(useNavigationStoreV2, import.meta.hot))
|
||||
}
|
||||
Reference in New Issue
Block a user