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
703 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())
5 years ago
} else if (TokenService.getToken() && UserService.get() && UserService.get().is_owner == 'false') {
store.dispatch('auth/loadAuthPermissions');
}
if (UserService.get()) {
store.commit('auth/SET_AUTH_USER', UserService.get())
5 years ago
}
import '@Global/services/errorHandler.services'