store added

This commit is contained in:
Inshal
2024-05-30 02:57:17 +05:00
parent 08c591d635
commit c0a49cc1b6
4 changed files with 40 additions and 2 deletions

View File

@@ -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)

24
resources/js/store.js Normal file
View File

@@ -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
},
}
})