Files
web-temp/layers/stores/usePageDataStore.ts

26 lines
597 B
TypeScript

import type { PageDataValue } from '#layers/types/api/pageData'
export const usePageDataStore = defineStore('pageData', () => {
const pageData = ref<PageDataValue | null>(null)
const pageLayoutType = ref<'default' | 'promotion' | null>(null)
const setPageData = (response: PageDataValue) => {
clearPageData()
pageData.value = response
pageLayoutType.value = getLayoutType(pageData.value)
}
const clearPageData = () => {
pageData.value = null
pageLayoutType.value = null
}
return {
pageData,
pageLayoutType,
setPageData,
clearPageData,
}
})