We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4148616 commit f5f596cCopy full SHA for f5f596c
frontend/src/api/getCsrfToken.ts
@@ -5,14 +5,14 @@ export const getInitialCsrfToken = async () => {
5
try {
6
const response = await fetch(CSRF_URL, {
7
method: 'GET',
8
+ credentials: 'include',
9
})
10
11
if (!response.ok) {
12
throw new AppError(response.status, 'Failed to fetch CSRF token')
13
}
14
15
const data = await response.json()
- document.cookie = `csrftoken=${data.csrftoken}; path=/; SameSite=Lax${window.location.protocol === 'https:' ? '; Secure' : ''}`
16
return data.csrftoken
17
} catch (error) {
18
if (error instanceof AppError) {
0 commit comments