This commit is contained in:
leijiaping
2026-04-11 09:44:44 +08:00
parent 08c7ea1ade
commit 0f82af13c9
2 changed files with 3 additions and 1 deletions

View File

@@ -9,6 +9,8 @@ const http = axios.create({
"Content-Type": HTTP_CONTENT_TYPE.APPLICATION_JSON,
},
baseURL: import.meta.env.VITE_API_URL,
xsrfCookieName: "csrftoken",
xsrfHeaderName: "X-XSRF-TOKEN",
});
// 设置实例的原型

View File

@@ -5,7 +5,7 @@ import router from "@/router";
import { getCsrfToken } from "./csrf";
export const downloadFile = (res: any) => {
const [, filename] = res.headers["content-disposition"]?.split(";");
const [, filename] = res.headers?.["content-disposition"]?.split(";") || [];
const link = document.createElement("a");
link.download = decodeURIComponent(
filename?.replace("filename=", "").replace(/\"/g, "").trim() || "",