You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

48 lines
847 B

import { login } from '@/api/auth'
import { setToken } from '@/common/auth'
// #ifndef VUE3
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
// #endif
// #ifdef VUE3
import { createStore } from 'vuex'
const store = createStore({
// #endif
state: {
hasLogin: false,
user: {},
requestUrl: '',
appCredential: '',
userCredential: ''
},
mutations: {
logout(state) {
state.hasLogin = false
},
setUser(state, user) {
state.hasLogin = true;
state.user = user
},
setRequestUrl(state, requestUrl) {
state.requestUrl = requestUrl
},
setAppCredential(state, appCredential) {
state.appCredential = appCredential
},
setUserCredential(state, userCredential) {
state.userCredential = userCredential
},
},
getters: {
},
actions: {
}
})
export default store