diff --git a/package-lock.json b/package-lock.json index e141f36..5f13ff2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -48,6 +48,7 @@ "vue3-apexcharts": "^1.4.4", "vue3-perfect-scrollbar": "^1.6.1", "vuetify": "3.4.4", + "vuex": "^4.0.2", "webfontloader": "^1.6.28" }, "devDependencies": { @@ -13781,6 +13782,17 @@ } } }, + "node_modules/vuex": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/vuex/-/vuex-4.0.2.tgz", + "integrity": "sha512-M6r8uxELjZIK8kTKDGgZTYX/ahzblnzC4isU1tpmEuOIIKmV+TRdc+H4s8ds2NuZ7wpUTdGRzJRtoj+lI+pc0Q==", + "dependencies": { + "@vue/devtools-api": "^6.0.0-beta.11" + }, + "peerDependencies": { + "vue": "^3.0.2" + } + }, "node_modules/w3c-keyname": { "version": "2.2.8", "resolved": "https://registry.npmjs.org/w3c-keyname/-/w3c-keyname-2.2.8.tgz", diff --git a/package.json b/package.json index 62952e0..f5ccad1 100644 --- a/package.json +++ b/package.json @@ -51,6 +51,7 @@ "vue3-apexcharts": "^1.4.4", "vue3-perfect-scrollbar": "^1.6.1", "vuetify": "3.4.4", + "vuex": "^4.0.2", "webfontloader": "^1.6.28" }, "devDependencies": { diff --git a/resources/js/main.js b/resources/js/main.js index fae4837..d4e9927 100644 --- a/resources/js/main.js +++ b/resources/js/main.js @@ -1,14 +1,15 @@ -import { createApp } from 'vue' import App from '@/App.vue' import { registerPlugins } from '@core/utils/plugins' +import { createApp } from 'vue' // Styles import '@core-scss/template/index.scss' import '@styles/styles.scss' +import store from './store' // Create vue app const app = createApp(App) - +app.use(store) // Register plugins registerPlugins(app) diff --git a/resources/js/store.js b/resources/js/store.js new file mode 100644 index 0000000..782950c --- /dev/null +++ b/resources/js/store.js @@ -0,0 +1,24 @@ +// import axios from 'axios'; +import { createStore } from 'vuex'; +export default createStore({ + state: { + isLoading: false, + }, + mutations: { + setLoading(state, payload) { + console.log('payload'); + state.isLoading = payload + }, + }, + actions: { + + async updateIsLoading({ commit }, payload) { + commit('setLoading', payload) + }, + }, + getters: { + getIsLoading(state){ + return state.isLoading + }, + } +})