mirror of
https://git.meshkee.com/cssd/cssd-back.git
synced 2026-10-13 14:31:06 +03:30
ss
This commit is contained in:
+3
-6
@@ -95,7 +95,7 @@ const UserService = {
|
||||
**/
|
||||
logout: async function() {
|
||||
try {
|
||||
const response = await ApiService.post(urls.logout);
|
||||
await ApiService.post(urls.logout);
|
||||
// Remove the token and remove Authorization header from Api Service as well
|
||||
TokenService.removeToken();
|
||||
TokenService.removeRefreshToken();
|
||||
@@ -105,12 +105,9 @@ const UserService = {
|
||||
// NOTE: Again, we'll cover the 401 Interceptor a bit later.
|
||||
ApiService.unmount401Interceptor();
|
||||
|
||||
return response.data;
|
||||
return true;
|
||||
} catch (error) {
|
||||
throw new AuthenticationError(
|
||||
error.response.status,
|
||||
error.response.data.detail
|
||||
);
|
||||
return true
|
||||
}
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import axios from "axios";
|
||||
import toast from "./toast.service";
|
||||
import {TokenService, ApiService} from '@/services';
|
||||
import store from "@/store"
|
||||
import router from '@/router'
|
||||
function errorResponseHandler(error) {
|
||||
|
||||
// check for errorHandle config
|
||||
@@ -26,6 +28,8 @@ function errorResponseHandler(error) {
|
||||
TokenService.removeRefreshToken();
|
||||
TokenService.removeInfo();
|
||||
ApiService.removeAuthHeader();
|
||||
store.commit('auth/logoutSuccess', {}, {root: true})
|
||||
router.push({ name: `Dashboard` });
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user