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