修复csrftoken的问题

This commit is contained in:
2026-04-13 11:38:32 +08:00
parent e5fddfa5a6
commit a9096a858c
3 changed files with 3 additions and 2 deletions

View File

@@ -9,7 +9,7 @@ const http = axios.create({
"Content-Type": HTTP_CONTENT_TYPE.APPLICATION_JSON,
},
baseURL: import.meta.env.VITE_API_URL,
xsrfCookieName: "csrftoken",
xsrfCookieName: "XSRF-TOKEN",
xsrfHeaderName: "X-XSRF-TOKEN",
});

View File

@@ -57,6 +57,7 @@ export const setupInterceptors = (instance: AxiosInstance) => {
);
if (res.status !== 200) {
toast.error(res?.data?.msg || "请求失败,请稍后再试");
return Promise.reject(res.data);
}
// 文件下载

View File

@@ -27,7 +27,7 @@ export default defineConfig({
proxy: {
"/api": {
// target: "http://192.168.71.2:8080/", // 家
target: "http://192.168.1.23:8080/", // 公司
target: "http://192.168.1.36:8080/", // 公司
changeOrigin: true,
rewrite: (path) => path.replace(/^\/api/, ""),
}