salix-front/src/stores/useStateStore.js

44 lines
920 B
JavaScript
Raw Normal View History

2023-02-09 14:07:27 +00:00
import { ref } from 'vue';
import { defineStore } from 'pinia';
export const useStateStore = defineStore('stateStore', () => {
const isMounted = ref(false);
const leftDrawer = ref(false);
const rightDrawer = ref(false);
function toggleLeftDrawer() {
leftDrawer.value = !leftDrawer.value;
}
function toggleRightDrawer() {
rightDrawer.value = !rightDrawer.value;
}
function setMounted() {
isMounted.value = true;
}
function isHeaderMounted() {
return isMounted.value;
}
function isLeftDrawerShown() {
return leftDrawer.value;
}
function isRightDrawerShown() {
return rightDrawer.value;
}
return {
leftDrawer,
rightDrawer,
setMounted,
isHeaderMounted,
toggleLeftDrawer,
toggleRightDrawer,
isLeftDrawerShown,
isRightDrawerShown,
};
});