mirror of
https://github.com/seanmorley15/AdventureLog.git
synced 2025-08-04 20:55:19 +02:00
commit
6289c7e305
11 changed files with 32 additions and 18 deletions
|
@ -60,11 +60,8 @@
|
|||
}
|
||||
|
||||
async function deleteAdventure() {
|
||||
let res = await fetch(`/adventures/${adventure.id}?/delete`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded'
|
||||
}
|
||||
let res = await fetch(`/api/adventures/${adventure.id}`, {
|
||||
method: 'DELETE'
|
||||
});
|
||||
if (res.ok) {
|
||||
addToast('info', $t('adventures.adventure_delete_success'));
|
||||
|
|
|
@ -37,7 +37,8 @@ export const actions: Actions = {
|
|||
headers: {
|
||||
'X-CSRFToken': csrfToken,
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: `csrftoken=${csrfToken}`
|
||||
Cookie: `csrftoken=${csrfToken}`,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
}
|
||||
});
|
||||
console.log(res);
|
||||
|
|
|
@ -69,7 +69,8 @@ export const actions: Actions = {
|
|||
method: 'POST',
|
||||
headers: {
|
||||
Cookie: `csrftoken=${csrfToken}; sessionid=${sessionId}`,
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRFToken': csrfToken,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
body: formData
|
||||
});
|
||||
|
|
|
@ -66,7 +66,9 @@ export const actions: Actions = {
|
|||
let res = await fetch(`${serverEndpoint}/api/adventures/${event.params.id}`, {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
Cookie: `sessionid=${event.cookies.get('sessionid')}; csrftoken=${csrfToken}`,
|
||||
Referer: event.url.origin, // Include Referer header
|
||||
Cookie: `sessionid=${event.cookies.get('sessionid')};
|
||||
csrftoken=${csrfToken}`,
|
||||
'X-CSRFToken': csrfToken
|
||||
},
|
||||
credentials: 'include'
|
||||
|
|
|
@ -96,6 +96,7 @@ export const actions: Actions = {
|
|||
method: 'POST',
|
||||
headers: {
|
||||
'X-CSRFToken': csrfToken,
|
||||
Referer: event.url.origin, // Include Referer header
|
||||
Cookie: `sessionid=${sessionid}; csrftoken=${csrfToken}`
|
||||
},
|
||||
body: formDataToSend
|
||||
|
@ -174,9 +175,11 @@ export const actions: Actions = {
|
|||
method: 'PATCH',
|
||||
headers: {
|
||||
'X-CSRFToken': csrfToken,
|
||||
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`
|
||||
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
body: formDataToSend,
|
||||
|
||||
credentials: 'include'
|
||||
});
|
||||
|
||||
|
|
|
@ -63,7 +63,8 @@ export const actions: Actions = {
|
|||
headers: {
|
||||
Cookie: `sessionid=${sessionId}; csrftoken=${csrfToken}`,
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRFToken': csrfToken,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
credentials: 'include'
|
||||
});
|
||||
|
|
|
@ -46,7 +46,8 @@ export const actions: Actions = {
|
|||
headers: {
|
||||
'X-CSRFToken': csrfToken,
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: `csrftoken=${csrfToken}`
|
||||
Cookie: `csrftoken=${csrfToken}`,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
body: JSON.stringify({ username, password }),
|
||||
credentials: 'include'
|
||||
|
@ -73,7 +74,8 @@ export const actions: Actions = {
|
|||
headers: {
|
||||
'X-CSRFToken': csrfToken,
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: `csrftoken=${csrfToken}; sessionid=${sessionId}`
|
||||
Cookie: `csrftoken=${csrfToken}; sessionid=${sessionId}`,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
body: JSON.stringify({ code: totp }),
|
||||
credentials: 'include'
|
||||
|
|
|
@ -56,7 +56,8 @@ export const actions: Actions = {
|
|||
headers: {
|
||||
'X-CSRFToken': csrfToken,
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: `csrftoken=${csrfToken}`
|
||||
Cookie: `csrftoken=${csrfToken}`,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
body: JSON.stringify({
|
||||
username: username,
|
||||
|
|
|
@ -21,7 +21,8 @@ export const actions: Actions = {
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'X-CSRFToken': csrfToken,
|
||||
Cookie: `csrftoken=${csrfToken}`
|
||||
Cookie: `csrftoken=${csrfToken}`,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
body: JSON.stringify({
|
||||
email
|
||||
|
|
|
@ -35,7 +35,8 @@ export const actions: Actions = {
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Cookie: `csrftoken=${csrfToken}`,
|
||||
'X-CSRFToken': csrfToken
|
||||
'X-CSRFToken': csrfToken,
|
||||
Referer: event.url.origin // Include Referer header
|
||||
},
|
||||
method: 'POST',
|
||||
credentials: 'include',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue