update 401 handler
This commit is contained in:
1 parent
396b77406d
commit
98a7532235
2 files changed
+10
-10
No files matched your search
@@ -100,9 +100,7 @@ export default defineComponent({
|
||||
deep: true
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.getApplications();
|
||||
},
|
||||
mounted() {},
|
||||
methods: {
|
||||
urlJoin,
|
||||
getApplications() {
|
||||
@@ -112,7 +110,8 @@ export default defineComponent({
|
||||
})
|
||||
.then(({ data: data }: { data: IApplicationListResponse }) => {
|
||||
this.applications = data.items;
|
||||
});
|
||||
})
|
||||
.catch((error) => {});
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import router, { ROUTE_INDEX } from '@/router';
|
||||
import router, { ROUTE_AUTH_LOGIN, ROUTE_INDEX } from '@/router';
|
||||
import store from '@/store';
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import { getCookie } from 'typescript-cookie';
|
||||
@@ -26,11 +26,12 @@ httpClient.interceptors.response.use(
|
||||
(error) => {
|
||||
if (error?.response?.status === 401) {
|
||||
store.dispatch('resetAuth');
|
||||
setTimeout(() => {
|
||||
router.push({
|
||||
name: ROUTE_INDEX
|
||||
});
|
||||
}, 1000);
|
||||
router.push({
|
||||
name: ROUTE_AUTH_LOGIN,
|
||||
query: {
|
||||
redirect: router?.currentRoute?.value?.path
|
||||
}
|
||||
});
|
||||
}
|
||||
return Promise.reject(error);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user