Files
Website/resources/js/store/ApplicationStore.ts
2023-02-24 10:11:32 +10:00

28 lines
626 B
TypeScript

import { defineStore } from "pinia";
export interface ApplicationStore {
dynamicTitle: string;
}
export const useApplicationStore = defineStore({
id: "application",
state: (): ApplicationStore => ({
dynamicTitle: "",
}),
actions: {
async setDynamicTitle(title: string) {
this.$state.dynamicTitle = title;
document.title = "STEMMechanics | " + title;
},
clearDynamicTitle() {
this.$state.dynamicTitle = "";
},
setRouterLoading(loading: boolean) {
this.$state.routerLoading = loading;
},
},
});