hookehuyr

fix

/*
* @Date: 2023-10-27 11:12:24
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-11-21 15:23:46
* @LastEditTime: 2023-11-30 18:12:27
* @FilePath: /vue-flow-editor/doc/axios.js
* @Description: 文件描述
*/
import axios from 'axios';
import { ElMessageBox } from 'element-plus'
axios.defaults.params = {
m: 'mod',
......@@ -38,6 +39,19 @@ axios.interceptors.request.use(
*/
axios.interceptors.response.use(
response => {
// 默认显示错误提示
response.data.show = true;
if (response.data.msg === '登录失效') {
ElMessageBox.alert('登录失效!将跳转到登录页面。', '温馨提示', {
confirmButtonText: '确定',
callback: action => {
// session 失效需要重新登录
if (action === 'confirm') {
window.parent.location.href = location.origin + '/admin/' + window.parent.location.search;
}
}
});
}
return response;
},
error => {
......