|
|
@@ -1,12 +1,12 @@ |
|
|
|
/* |
|
|
|
* @Date: 2021-12-08 15:59:46 |
|
|
|
* @LastEditors: JinxuChen |
|
|
|
* @LastEditTime: 2021-12-14 09:25:12 |
|
|
|
* @LastEditTime: 2021-12-14 09:40:30 |
|
|
|
* @FilePath: \GpsCardAdmin\src\utils\request.js |
|
|
|
* @description: |
|
|
|
*/ |
|
|
|
import axios from 'axios' |
|
|
|
import { MessageBox, Message } from 'element-ui' |
|
|
|
import { Message } from 'element-ui' |
|
|
|
import store from '@/store' |
|
|
|
/* import { getToken } from '@/utils/auth' */ |
|
|
|
|
|
|
@@ -63,7 +63,7 @@ service.interceptors.response.use( |
|
|
|
// 106 token验证过期; |
|
|
|
if (res.code === 106) { |
|
|
|
// to re-login |
|
|
|
MessageBox.confirm('登录过期,是否重新登录?', { |
|
|
|
/* MessageBox.confirm('登录过期,是否重新登录?', { |
|
|
|
confirmButtonText: '确认', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
@@ -71,7 +71,17 @@ service.interceptors.response.use( |
|
|
|
store.dispatch('user/resetToken').then(() => { |
|
|
|
location.reload() |
|
|
|
}) |
|
|
|
}) |
|
|
|
}) */ |
|
|
|
setTimeout(() => { |
|
|
|
store.dispatch('user/resetToken').then(() => { |
|
|
|
Message({ |
|
|
|
message:/* res.message || */ 'token过期,请重新登录', |
|
|
|
type: 'error', |
|
|
|
duration: 1500 |
|
|
|
}) |
|
|
|
location.reload() |
|
|
|
}) |
|
|
|
}, 1500) |
|
|
|
} |
|
|
|
return Promise.reject(new Error(res.message || 'Error')) |
|
|
|
} else { |
|
|
|