Changeset View
Changeset View
Standalone View
Standalone View
src/resources/vue/js/store.js
import Vue from 'vue' | import Vue from 'vue' | ||||
import Vuex from 'vuex' | import Vuex from 'vuex' | ||||
Vue.use(Vuex) | Vue.use(Vuex) | ||||
export default new Vuex.Store({ | export default new Vuex.Store({ | ||||
state: { | state: { | ||||
isLoggedIn: !!localStorage.getItem('token') | isLoggedIn: !!localStorage.getItem('token'), | ||||
authInfo: null | |||||
}, | }, | ||||
mutations: { | mutations: { | ||||
loginUser (state) { | loginUser (state) { | ||||
state.isLoggedIn = true | state.isLoggedIn = true | ||||
}, | }, | ||||
logoutUser (state) { | logoutUser (state) { | ||||
state.isLoggedIn = false | state.isLoggedIn = false | ||||
state.authInfo = null | |||||
}, | }, | ||||
} | } | ||||
}) | }) |