|
@@ -2,6 +2,7 @@ import axios from 'axios'
|
|
|
import { Message } from 'element-ui'
|
|
|
import store from '@/store'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
+import { loginUrl } from '@/api/user.js'
|
|
|
|
|
|
// create an axios instance
|
|
|
const service = axios.create({
|
|
@@ -121,16 +122,16 @@ service.interceptors.response.use(
|
|
|
type: 'warning',
|
|
|
duration: 5 * 1000
|
|
|
})
|
|
|
+ if (error.response.status === 401) {
|
|
|
+ location.href = loginUrl
|
|
|
+ }
|
|
|
} else {
|
|
|
- error.message = '登录中'
|
|
|
+ error.message = 'error'
|
|
|
Message({
|
|
|
message: error.message,
|
|
|
type: 'warning',
|
|
|
duration: 5 * 1000
|
|
|
})
|
|
|
- if (location.href.indexOf('localhost') < 0) {
|
|
|
- // location.href = 'http://10.179.209.19:8899/'
|
|
|
- }
|
|
|
}
|
|
|
return Promise.reject(error)
|
|
|
}
|