1
0
Fork 0
mirror of https://github.com/seanmorley15/AdventureLog.git synced 2025-08-03 20:25:18 +02:00

fix: include Referer header and ensure CSRF token is set in request headers

This commit is contained in:
Sean Morley 2025-01-13 19:47:19 -05:00
parent a8e84be28e
commit 96ff727b57

View file

@ -37,8 +37,9 @@ export const actions: Actions = {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`, 'X-CSRFToken': csrfToken, // Ensure CSRF token is in header
'X-CSRFToken': csrfToken Referer: event.url.origin, // Include Referer header
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`
}, },
credentials: 'include' credentials: 'include'
}); });
@ -59,8 +60,6 @@ export const actions: Actions = {
cookieDomain = undefined; // Do not set the domain cookieDomain = undefined; // Do not set the domain
} }
console.log('Deleting sessionid cookie with domain:', cookieDomain);
// Delete the session cookie // Delete the session cookie
event.cookies.delete('sessionid', { event.cookies.delete('sessionid', {
path: '/', path: '/',