修复csrftoken的问题
This commit is contained in:
@@ -9,7 +9,7 @@ const http = axios.create({
|
|||||||
"Content-Type": HTTP_CONTENT_TYPE.APPLICATION_JSON,
|
"Content-Type": HTTP_CONTENT_TYPE.APPLICATION_JSON,
|
||||||
},
|
},
|
||||||
baseURL: import.meta.env.VITE_API_URL,
|
baseURL: import.meta.env.VITE_API_URL,
|
||||||
xsrfCookieName: "csrftoken",
|
xsrfCookieName: "XSRF-TOKEN",
|
||||||
xsrfHeaderName: "X-XSRF-TOKEN",
|
xsrfHeaderName: "X-XSRF-TOKEN",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ export const setupInterceptors = (instance: AxiosInstance) => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (res.status !== 200) {
|
if (res.status !== 200) {
|
||||||
|
toast.error(res?.data?.msg || "请求失败,请稍后再试");
|
||||||
return Promise.reject(res.data);
|
return Promise.reject(res.data);
|
||||||
}
|
}
|
||||||
// 文件下载
|
// 文件下载
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ export default defineConfig({
|
|||||||
proxy: {
|
proxy: {
|
||||||
"/api": {
|
"/api": {
|
||||||
// target: "http://192.168.71.2:8080/", // 家
|
// target: "http://192.168.71.2:8080/", // 家
|
||||||
target: "http://192.168.1.23:8080/", // 公司
|
target: "http://192.168.1.36:8080/", // 公司
|
||||||
changeOrigin: true,
|
changeOrigin: true,
|
||||||
rewrite: (path) => path.replace(/^\/api/, ""),
|
rewrite: (path) => path.replace(/^\/api/, ""),
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user