This commit is contained in:
Vaica committed 2026-06-22 15:55:09 +08:00
1 parent ad1f7618ff
commit 38e203512d
2 files changed
+22 -6

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
// 带认证的 fetch 封装
export async function authFetch(url: string, options: RequestInit = {}): Promise<Response> {
const token = localStorage.getItem("wauth_token");
const headers = new Headers(options.headers);
if (token) {
headers.set("X-Auth-User", token);
}
return fetch(url, { ...options, headers });
}