enable trailing slash on layout (excluding api paths)

This commit is contained in:
Yuri Tatishchev 2024-12-31 19:40:38 -08:00
parent d5b54722b3
commit 41066eefe4
Signed by: CaZzzer
GPG Key ID: E0EBF441EA424369
5 changed files with 10 additions and 8 deletions

View File

@ -1,9 +1,11 @@
import type { LayoutServerLoad } from "./$types";
import type { LayoutServerLoad } from './$types';
export const trailingSlash = 'always';
export const load: LayoutServerLoad = async (event) => {
const { user } = event.locals;
return {
user
user,
};
};

View File

@ -20,9 +20,9 @@
<ul class="flex items-center gap-6 overflow-x-auto text-sm">
<li><a href="/" class={getNavClass(/^\/$/)}>Home</a></li>
{#if user}
<li><a href="/user" class={getNavClass(/^\/user$/)}>Profile</a></li>
<li><a href="/connections" class={getNavClass(/^\/connections$/)}>Connections</a></li>
<li><a href="/clients" class={getNavClass(/^\/clients(\/\d+)?$/)}>Clients</a></li>
<li><a href="/user/" class={getNavClass(/^\/user\/$/)}>Profile</a></li>
<li><a href="/connections/" class={getNavClass(/^\/connections\/$/)}>Connections</a></li>
<li><a href="/clients/" class={getNavClass(/^\/clients(\/\d+)?\/$/)}>Clients</a></li>
{/if}
</ul>
</nav>

View File

@ -21,7 +21,7 @@
<section id="get-started" class="border-l-2 pl-6">
<p>
To get started,
<Button class="ml-2" href="/clients?add=New+Client">Create a New Client</Button>
<Button class="ml-2" href="/clients/?add=New+Client">Create a New Client</Button>
</p>
</section>
<!-- <section id="using-wireguard">-->

View File

@ -15,7 +15,7 @@ export const actions = {
switch (res._tag) {
case 'ok': {
return redirect(303, `/clients/${res.value}`);
return redirect(303, `/clients/${res.value}/`);
}
case 'err': {
const [status, message] = res.error;

View File

@ -41,7 +41,7 @@
<Table.Row class="group hover:bg-background hover:bg-opacity-40">
<Table.Head scope="row">
<a
href={`./${client.id}`}
href={`./${client.id}/`}
class="flex size-full items-center group-hover:underline"
>
{client.name}