画廊-瀑布流实现
This commit is contained in:
@ -1,3 +1,4 @@
|
||||
import router from "@/router";
|
||||
import type { AxiosError, AxiosResponse, InternalAxiosRequestConfig } from "axios";
|
||||
import axios from "axios";
|
||||
import { useCookies } from "vue3-cookies";
|
||||
@ -43,13 +44,21 @@ request.interceptors.response.use(
|
||||
// 对响应错误做点什么
|
||||
console.log("Response error", error);
|
||||
|
||||
// if (error.response?.status === 401) {
|
||||
// window.$msg.warning("无效的token");
|
||||
// cookies.remove("token");
|
||||
// cookies.remove("userinfo");
|
||||
// router.replace("/login");
|
||||
// return "Unauthorized";
|
||||
// }
|
||||
if (error.response?.status === 401) {
|
||||
// window.$msg.warning("无效的token");
|
||||
cookies.remove("token");
|
||||
cookies.remove("userinfo");
|
||||
window.$modal({
|
||||
title: "无效的token",
|
||||
content: "token已失效,需要登录,请登录 =>",
|
||||
handdleSubmit: () => {
|
||||
router.replace("/login");
|
||||
},
|
||||
});
|
||||
|
||||
// router.replace("/login");
|
||||
return "Unauthorized";
|
||||
}
|
||||
|
||||
return error.message || "Response error";
|
||||
}
|
||||
|
Reference in New Issue
Block a user