|
|
@@ -65,8 +65,15 @@ service.interceptors.response.use(response => {
|
|
|
}
|
|
|
return response
|
|
|
}, error => {
|
|
|
- if (--reqCount <= 0 && !process.server) {
|
|
|
- document.getElementById('loading').setAttribute('class', 'loading')
|
|
|
+ if (!process.server) {
|
|
|
+ if (--reqCount <= 0) {
|
|
|
+ document.getElementById('loading').setAttribute('class', 'loading')
|
|
|
+ }
|
|
|
+ // 401拦截
|
|
|
+ if (error.response.status === 401 && !/\/store-service\/stores$/g.test(error.response.config.url)) {
|
|
|
+ window.location.href = `/auth/login?returnUrl=${window.location.href}`
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
return Promise.reject(error)
|
|
|
})
|