Using correct cookie for credentials when fetching rsvps

This commit is contained in:
collin 2025-08-27 14:03:13 +02:00
parent 026f0c9d2a
commit a535d65b52
No known key found for this signature in database

View file

@ -29,10 +29,10 @@ function createRsvpEntry(rsvp) {
} }
async function getRsvps() { async function getRsvps() {
const token = Object.fromEntries( const credentials = Object.fromEntries(
document.cookie.split(";").map((x) => x.trim().split("=")) document.cookie.split(";").map((x) => x.trim().split("="))
)['token'] )['credentials']
const resp = await fetch('/api/rsvps', { headers: { 'Authorization': `Basic ${String(btoa(token))}`} }); const resp = await fetch('/api/rsvps', { headers: { 'Authorization': `Basic ${String(btoa(credentials))}`} });
const rsvps = await resp.json() const rsvps = await resp.json()
for (const rsvp of rsvps) { for (const rsvp of rsvps) {
createRsvpEntry(rsvp); createRsvpEntry(rsvp);