2025-07-23 13:46:18 +02:00
|
|
|
import type Global from "~~/types/single/global";
|
2025-05-10 17:37:58 +02:00
|
|
|
|
|
|
|
export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
|
const globalState = useState<Global | null>("global", () => null);
|
|
|
|
|
|
|
|
if (!globalState.value) {
|
|
|
|
const { findOne } = useStrapi();
|
|
|
|
const { data: global } = await useAsyncData("global", () => findOne<Global>("global"), {
|
|
|
|
server: true,
|
|
|
|
lazy: false,
|
|
|
|
default: () => {},
|
|
|
|
});
|
|
|
|
globalState.value = global.value?.data ?? null;
|
|
|
|
}
|
|
|
|
});
|