规范跨域代码,采用中间件的方式处理跨域

This commit is contained in:
柳清爽
2025-04-27 13:51:53 +08:00
parent ad60944f88
commit 71b2f12c77
7 changed files with 158 additions and 22 deletions

View File

@@ -43,7 +43,7 @@ export async function apiRequest<T = any>(
const options: RequestInit = {
method,
headers,
credentials: 'include', // 包含跨域请求Cookie
credentials: 'same-origin', // 改为same-origin避免跨域请求发送Cookie
};
// 添加请求体针对POST、PUT请求