55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
import { createStore } from "vuex";
|
|
|
|
const store = createStore({
|
|
state() {
|
|
return {
|
|
assetEditable: false,
|
|
onAssetlist: true,
|
|
onCustomerAssetlist: false,
|
|
onAsset: false,
|
|
onSolutionlistAsset: false,
|
|
chosenAssetId: -1
|
|
};
|
|
},
|
|
mutations: {
|
|
toggleEditableAsset(state) {
|
|
state.assetEditable = !state.assetEditable
|
|
},
|
|
changeToAssetlist(state) {
|
|
state.onAssetlist = true
|
|
state.onCustomerAssetlist = false
|
|
state.onAsset = false
|
|
state.onSolutionlistAsset = false
|
|
},
|
|
changeToCustomerAssetlist(state) {
|
|
state.onAssetlist = false
|
|
state.onCustomerAssetlist = true
|
|
state.onAsset = false
|
|
state.onSolutionlistAsset = false
|
|
},
|
|
changeToAsset(state) {
|
|
state.onAssetlist = false
|
|
state.onCustomerAssetlist = false
|
|
state.onAsset = true
|
|
state.onSolutionlistAsset = false
|
|
},
|
|
changeToSolutionlistAsset(state) {
|
|
state.onAssetlist = false
|
|
state.onCustomerAssetlist = false
|
|
state.onAsset = false
|
|
state.onSolutionlistAsset = true
|
|
},
|
|
setChosenAsset(state, id) {
|
|
state.chosenAssetId = id
|
|
},
|
|
resetAssetStore(state) {
|
|
state.chosenAssetId = -1
|
|
state.assetEditable = false
|
|
},
|
|
},
|
|
});
|
|
|
|
export default defineNuxtPlugin((nuxtApp) => {
|
|
nuxtApp.vueApp.use(store);
|
|
// Install the store instance as a plugin
|
|
}); |