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.
iot/projects/WebMVC/wwwroot/js/state.js

19 lines
502 B

Vue.use(Vuex);
const store = new Vuex.Store({
state: {
token: {
accessToken: localStorage.getItem("accessToken"),
refreshToken: localStorage.getItem("refreshToken")
}
},
mutations: {
setState(state,data) {
state[data.key] = data.value;
},
logout(state) {
localStorage.removeItem('accessToken');
localStorage.removeItem('refreshToken');
state.token = null;
}
}
});