Ne uplne otestovany prepis storu
This commit is contained in:
+23
-18
@@ -1,22 +1,27 @@
|
||||
import {defineStore} from 'pinia'
|
||||
import {ref} from "vue";
|
||||
|
||||
export const useAppStore = defineStore('App', {
|
||||
state: () => ({
|
||||
pageTitle: null,
|
||||
breadcrumbs: [],
|
||||
appStatus: 200
|
||||
}),
|
||||
actions: {
|
||||
resetAfterRouteChange() {
|
||||
this.setPageTitle("");
|
||||
this.setBreadcrumbs([]);
|
||||
this.appStatus = 200;
|
||||
},
|
||||
setPageTitle(pageTitle) {
|
||||
this.pageTitle = pageTitle;
|
||||
},
|
||||
setBreadcrumbs(breadcrumbs) {
|
||||
this.breadcrumbs = breadcrumbs;
|
||||
}
|
||||
export const useAppStore = defineStore('App', () => {
|
||||
const pageTitle = ref(null);
|
||||
const breadcrumbs = ref([]);
|
||||
const appStatus = ref(200); // TODO: toto nejspis nebude potreba!
|
||||
|
||||
const resetAfterRouteChange = () => {
|
||||
setPageTitle("");
|
||||
setBreadcrumbs([]);
|
||||
appStatus.value = 200;
|
||||
};
|
||||
|
||||
const setPageTitle = (value) => {
|
||||
// TODO: je toto vubec potreba?
|
||||
pageTitle.value = value;
|
||||
}
|
||||
const setBreadcrumbs = (items) => {
|
||||
// TODO: je toto vubec potreba?
|
||||
breadcrumbs.value = items;
|
||||
}
|
||||
|
||||
return {
|
||||
pageTitle, breadcrumbs, appStatus, resetAfterRouteChange, setPageTitle, setBreadcrumbs
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user