This commit is contained in:
NotII
2025-03-24 16:53:19 +00:00
parent 11d32a2c46
commit 8534ed040c
3 changed files with 15 additions and 13 deletions

View File

@@ -32,12 +32,13 @@ function getAuthToken(): string | null {
function createApiHeaders(token?: string | null, customHeaders: Record<string, string> = {}): Headers {
const headers = new Headers({
'Content-Type': 'application/json',
'accept': '*/*',
...customHeaders
});
const authToken = token || getAuthToken();
if (authToken) {
headers.set('Authorization', `Bearer ${authToken}`);
headers.set('authorization', `Bearer ${authToken}`);
}
return headers;
@@ -59,6 +60,8 @@ export async function clientFetch<T = any>(url: string, options: RequestInit = {
...options,
headers,
credentials: 'include',
mode: 'cors',
referrerPolicy: 'strict-origin-when-cross-origin'
});
if (!res.ok) {