fix sveltekit load / preload bug on logout

This commit is contained in:
JCEEE
2026-09-08 19:05:04 +01:00
parent de6047f406
commit 6ed1805884
3 changed files with 62 additions and 15 deletions
+37 -6
View File
@@ -6,13 +6,44 @@
<div class="error-page">
<h1>Something went wrong</h1>
<p>{error?.message || 'An unexpected error occurred.'}</p>
<p class="hint">Try <a href="/logout">logging out</a> and signing in again.</p>
<div class="hint">
Try
<form method="POST" action="/logout" class="inline-form">
<button type="submit" class="link-button">logging out</button>
</form>
and signing in again.
</div>
</div>
<style>
.error-page { max-width: 480px; margin: 4rem auto; text-align: center; padding: 2rem; }
h1 { font-size: 1.5rem; color: #111827; margin-bottom: 0.5rem; }
p { color: #6b7280; }
.hint { margin-top: 1.5rem; font-size: 0.9rem; }
a { color: #6366f1; }
.error-page {
max-width: 480px;
margin: 4rem auto;
text-align: center;
padding: 2rem;
}
h1 {
font-size: 1.5rem;
color: #111827;
margin-bottom: 0.5rem;
}
p {
color: #6b7280;
}
.hint {
margin-top: 1.5rem;
font-size: 0.9rem;
}
.inline-form {
display: inline-block;
}
.link-button {
background: none;
border: none;
padding: 0;
font: inherit;
color: #6366f1;
text-decoration: underline;
cursor: pointer;
}
</style>
@@ -6,11 +6,6 @@ function signOut(event: { cookies: any }) {
clearLegacyCookies(event.cookies);
}
export function load(event) {
signOut(event);
throw redirect(303, '/');
}
export const actions = {
default: (event) => {
signOut(event);