20 lines
564 B
TypeScript
20 lines
564 B
TypeScript
import type { PublicSite } from "@imen/shared";
|
|||
|
|
import { defineStore } from "pinia";
|
||
|
|
|
||
|
|
/** Website content from the API (`GET /api/public/site`), loaded once per SSR render in app.vue */
|
||
|
|
export const useSiteStore = defineStore("site", {
|
||
|
|
state: () => ({
|
||
|
|
data: null as PublicSite | null,
|
||
|
|
}),
|
||
|
|
getters: {
|
||
|
|
sections: (s) => s.data!.sections,
|
||
|
|
settings: (s) => s.data!.sections.settings,
|
||
|
|
categories: (s) => s.data!.categories,
|
||
|
|
},
|
||
|
|
actions: {
|
||
|
|
async load() {
|
||
|
|
this.data = await useNuxtApp().$api<PublicSite>("/public/site");
|
||
|
|
},
|
||
|
|
},
|
||
|
|
});
|