misc_pterodactyl-panel/resources/assets/scripts/store.js
2018-05-28 12:48:42 -07:00

28 lines
604 B
JavaScript

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;
}
}
};