Relative links to fix deployment to subpaths

This commit is contained in:
Markus Brueckner 2024-12-27 08:33:44 +01:00
parent 978929eb13
commit dfa45436d4
8 changed files with 14 additions and 13 deletions

View file

@ -37,7 +37,7 @@ export function setSessionTokenCookie(event: RequestEvent, token: string, expire
httpOnly: true, httpOnly: true,
sameSite: "lax", sameSite: "lax",
expires: expiresAt, expires: expiresAt,
path: "/" path: "/" // TODO this should be limited to the path the application is running on
}); });
} }
@ -46,6 +46,6 @@ export function deleteSessionTokenCookie(event: RequestEvent): void {
httpOnly: true, httpOnly: true,
sameSite: "lax", sameSite: "lax",
maxAge: 0, maxAge: 0,
path: "/" path: "/" // TODO this should be limited to the path the application is running on
}); });
} }

View file

@ -16,7 +16,7 @@
{#each data.surveys as survey} {#each data.surveys as survey}
<li class="grid grid-cols-2"> <li class="grid grid-cols-2">
<div> <div>
<Link href="/survey/{survey.id}">{survey.title}</Link> <Link href="survey/{survey.id}">{survey.title}</Link>
<span class="mr-5 inline-block"> <span class="mr-5 inline-block">
({survey.fillRate.filled}/{survey.fillRate.expected}) ({survey.fillRate.filled}/{survey.fillRate.expected})
{#if survey.fillRate.filled === survey.fillRate.expected} {#if survey.fillRate.filled === survey.fillRate.expected}
@ -26,7 +26,7 @@
</div> </div>
<div> <div>
<Link <Link
href="/survey/new?from={survey.id}" href="survey/new?from={survey.id}"
class="ml-2 inline-block hover:bg-slate-200" class="ml-2 inline-block hover:bg-slate-200"
title="Duplicate survey" title="Duplicate survey"
aria-label="Duplicate survey" aria-label="Duplicate survey"
@ -37,5 +37,5 @@
{/each} {/each}
</ul> </ul>
<Link href="/survey/new">Create a new Survey</Link> <Link href="survey/new">Create a new Survey</Link>
</div> </div>

View file

@ -32,7 +32,7 @@
await fetch('', { await fetch('', {
method: 'DELETE' method: 'DELETE'
}); });
goto('/'); goto('..');
} }
</script> </script>
@ -42,7 +42,7 @@
<HomeIcon /> <HomeIcon />
</a> </a>
<a <a
href="/survey/new?from={data.id}" href="../survey/new?from={data.id}"
class="ml-2 flex items-center" class="ml-2 flex items-center"
aria-label="Duplicate" aria-label="Duplicate"
title="Duplicate" title="Duplicate"

View file

@ -49,7 +49,7 @@ export const actions = {
redirect(303, redirect_uri); redirect(303, redirect_uri);
} }
else { else {
redirect(303, '/'); redirect(303, '.');
} }
} }
else { else {

View file

@ -18,7 +18,7 @@
> >
{#if data.enableRegister} {#if data.enableRegister}
<span class="col-span-2 mt-3 justify-self-center text-xs"> <span class="col-span-2 mt-3 justify-self-center text-xs">
<Link href="/register">Click here to register</Link>, if you do not have an account yet</span <Link href="../register">Click here to register</Link>, if you do not have an account yet</span
> >
{/if} {/if}
</form> </form>

View file

@ -35,6 +35,6 @@ export const actions = {
sendVerificationEmail(email, result.verificationCode, getBaseUrl(event.url)); sendVerificationEmail(email, result.verificationCode, getBaseUrl(event.url));
} }
redirect(303, '/register/success'); redirect(303, 'register/success');
} }
} satisfies Actions; } satisfies Actions;

View file

@ -12,6 +12,6 @@
An email has been sent to your email address to activate the account. Please follow the An email has been sent to your email address to activate the account. Please follow the
instructions in the email to be able to log in. instructions in the email to be able to log in.
{:else} {:else}
Click <Link href="/login">here</Link> to log in. Click <Link href="../../login">here</Link> to log in.
{/if} {/if}
</p> </p>

View file

@ -7,6 +7,7 @@
<Navbar title="Verification successful" /> <Navbar title="Verification successful" />
<div> <div>
Congratulations! You've successfully verified your account. <Link href="/login">Click here</Link> to Congratulations! You've successfully verified your account. <Link href="../../login"
log in. >Click here</Link
> to log in.
</div> </div>