26 lines
924 B
TypeScript
26 lines
924 B
TypeScript
import type BaseFile from "../types/component/baseFile";
|
|
import type Footer from "../types/component/global/footer";
|
|
import type Navbar from "../types/component/global/navbar";
|
|
import type SEO from "../types/component/global/seo";
|
|
import type Global from "../types/single/global";
|
|
|
|
export const useGlobal = () => {
|
|
const global = useState<Global | null>("global");
|
|
const runtimeConfig = useRuntimeConfig();
|
|
const appTitle = runtimeConfig.public.app.title;
|
|
|
|
const logo = computed<BaseFile | null>(() => global.value?.logo ?? null);
|
|
const navbar = computed<Navbar | null>(() => global.value?.navbar ?? null);
|
|
const footer = computed<Footer | null>(() => global.value?.footer ?? null);
|
|
const seo = computed<SEO | null>(() => global.value?.SEO ?? null);
|
|
const title = computed<string>(() => seo.value?.metaTitle ?? appTitle);
|
|
|
|
return {
|
|
logo,
|
|
global,
|
|
navbar,
|
|
footer,
|
|
seo,
|
|
title,
|
|
};
|
|
};
|