mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-27 02:23:44 +02:00
Add JWT to login forms
This commit is contained in:
28
resources/assets/scripts/store.js
Normal file
28
resources/assets/scripts/store.js
Normal file
@@ -0,0 +1,28 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user