11 lines
375 B
TypeScript
11 lines
375 B
TypeScript
import { store, useAppStore } from "@/store";
|
|
import { NavigationGuardWithThis } from "vue-router";
|
|
|
|
export const titleGuard: NavigationGuardWithThis<undefined> = function (to, from, next) {
|
|
const appStore = useAppStore(store);
|
|
const title = to.meta.title || appStore.title;
|
|
const subtitle = appStore.subtitle;
|
|
document.title = `${title} | ${subtitle}`;
|
|
next();
|
|
};
|