| | |
| | | // 新建响应拦截器 |
| | | axiosInstance.interceptors.response.use((response) => { |
| | | |
| | | console.log(response.status) |
| | | // console.log(response.status) |
| | | // debugger |
| | | // 请求失败 |
| | | if (response.status !== 200) { |
| | |
| | | // 未登录 |
| | | if (response.data.code === 401) { |
| | | if (response.config.autoLogin !== false) { |
| | | window.location.href = process.env.VUE_APP_ROUTER_MODE === 'history' ? '/#/login' : '/login' |
| | | location.reload() |
| | | // window.location.href = process.env.VUE_APP_ROUTER_MODE === 'history' ? '/login' : '/#/login' |
| | | } |
| | | return Promise.reject(response.data) |
| | | } |