This commit is contained in:
2026-05-09 01:20:30 +03:00
parent 5254633a02
commit 56e32688e0
2 changed files with 4 additions and 1 deletions

View File

@@ -6,6 +6,7 @@ async function request<T>(path: string, options: RequestInit = {}): Promise<T> {
const res = await fetch(`${API_URL}${path}`, {
...options,
credentials: 'include',
headers: {
'Content-Type': 'application/json',
'X-CSRF-Token': token,

View File

@@ -9,7 +9,9 @@ let cachedToken: string | null = null
export async function getCsrfToken(): Promise<string> {
if (cachedToken) return cachedToken
const res = await fetch(`${API_URL}/csrf/token`)
const res = await fetch(`${API_URL}/csrf/token`, {
credentials: 'include',
})
const data: CsrfResponse = await res.json()
cachedToken = data.token
return cachedToken