misc_pterodactyl-panel/resources/assets/scripts/store.js

29 lines
604 B
JavaScript
Raw Normal View History

2018-05-28 19:48:42 +00:00
import User from './models/user';
export const storeData = {
state: {
user: null,
},
actions: {
login: function ({ commit }) {
commit('login');
},
logout: function ({ commit }) {
commit('logout');
},
},
getters: {
user: function (state) {
return state.user;
},
},
mutations: {
login: function (state) {
state.user = new User().fromJwt(localStorage.getItem('token'));
},
logout: function (state) {
state.user = null;
}
}
};