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.
willaengine/resources/js/Global/plugins/auth.js

20 lines
612 B

import { TokenService, PermissionService, UserService } from "@Global/services/storage.services";
import ApiService from "@Global/services/api.services";
import store from "@Core/store/index";
ApiService.init();
// If token exists set Authorizion header
if (TokenService.getToken()) {
ApiService.setAuthHeader();
}
if (PermissionService.get()) {
store.commit('auth/SET_AUTH_PERMISSIONS', PermissionService.get())
} else {
store.dispatch('auth/loadAuthPermissions');
}
if (UserService.get()) {
store.commit('auth/SET_AUTH_USER', UserService.get())
}
import '@Global/services/errorHandler.services'