f
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user