- aggiornamento refreshtoken (parte 1)
- PCB: fix listino
This commit is contained in:
@@ -19,6 +19,7 @@ function handle(status: number, exclude: number[]) {
|
||||
return exclude.find(o => o === status) === undefined
|
||||
}
|
||||
|
||||
|
||||
export function UseAxios(router: any) { // VueRouter
|
||||
if (!initialized) {
|
||||
// @ts-ignore
|
||||
@@ -42,10 +43,10 @@ export function UseAxios(router: any) { // VueRouter
|
||||
return config
|
||||
})
|
||||
|
||||
axios.interceptors.response.use(undefined, (config: AxiosError) => {
|
||||
axios.interceptors.response.use(undefined, (error: AxiosError) => {
|
||||
// @ts-ignore
|
||||
const { response } = config
|
||||
const exclude = (<IRequestConfig>config.config).ignore || []
|
||||
const { response } = error
|
||||
const exclude = (<IRequestConfig>error.config).ignore || []
|
||||
|
||||
if (response) {
|
||||
if (response.status === 401 && handle(response.status, exclude)) {
|
||||
@@ -59,10 +60,11 @@ export function UseAxios(router: any) { // VueRouter
|
||||
|
||||
if (response.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_INVALID_TOKEN && handle(response.status, exclude)) {
|
||||
window.setTimeout(() => router.replace('/forbidden'), 200)
|
||||
// } else if (response.status === serv_constants.RIS_CODE__HTTP_FORBIDDEN_TOKEN_EXPIRED) {
|
||||
}
|
||||
}
|
||||
|
||||
return config
|
||||
return error
|
||||
})
|
||||
|
||||
initialized = true
|
||||
|
||||
Reference in New Issue
Block a user