Skip to content

Commit f5f596c

Browse files
committed
added credentials so that cookie will be set by it
1 parent 4148616 commit f5f596c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

frontend/src/api/getCsrfToken.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ export const getInitialCsrfToken = async () => {
55
try {
66
const response = await fetch(CSRF_URL, {
77
method: 'GET',
8+
credentials: 'include',
89
})
910

1011
if (!response.ok) {
1112
throw new AppError(response.status, 'Failed to fetch CSRF token')
1213
}
1314

1415
const data = await response.json()
15-
document.cookie = `csrftoken=${data.csrftoken}; path=/; SameSite=Lax${window.location.protocol === 'https:' ? '; Secure' : ''}`
1616
return data.csrftoken
1717
} catch (error) {
1818
if (error instanceof AppError) {

0 commit comments

Comments
 (0)