My redirect doesn't work in this code
method: 'POST',
body: JSON.stringify(body),
headers: { 'Content-Type': 'application/json' },
}).then(async (response) => {
if (response.ok) {
try {
const UUID = crypto.randomUUID();
const startedAt = Math.floor(Date.now() / 1000);
const maxAge = 60 * 60 * 24;
const userID = parseInt(await response.text());
await prisma.sessions.create({
data: {
sessionID: UUID,
startedAt: startedAt,
endsAt: maxAge,
userID: userID,
},
});
console.log('cookie set');
Astro.cookies.set('sessionID', UUID, {
httpOnly: true,
maxAge: maxAge,
});
return Astro.redirect('https://twitch.tv');
} catch (error) {}
}
});```