diff --git a/frontend/src/routes/(app)/links/+page.server.ts b/frontend/src/routes/(app)/links/+page.server.ts index a1e1f1a..4f486a2 100644 --- a/frontend/src/routes/(app)/links/+page.server.ts +++ b/frontend/src/routes/(app)/links/+page.server.ts @@ -27,7 +27,7 @@ export const load = (async (event) => { } } - const shorteners = await db.query.shortener.findMany({ + const shorteners = db.query.shortener.findMany({ with: { visitor: true, project: true, @@ -47,5 +47,10 @@ export const load = (async (event) => { where: (settings, { eq }) => eq(settings.userId, user.id), }) - return { shorteners, projects, selected_project, settings } + return { + shorteners, + projects, + selected_project, + settings, + } }) satisfies PageServerLoad diff --git a/frontend/src/routes/(app)/links/+page.svelte b/frontend/src/routes/(app)/links/+page.svelte index 8a99332..dacebe9 100644 --- a/frontend/src/routes/(app)/links/+page.svelte +++ b/frontend/src/routes/(app)/links/+page.svelte @@ -161,96 +161,104 @@ -{#if data.shorteners.length > 0} -
- {#each data.shorteners as shortener} - - - - -
- - {#if shortener.active} - - Active - {:else} - - Inactive - {/if} - - {shortener.project - ? shortener.project.name - : 'Uncategorized'} -
-
- {shortener.link} -
- -
-
- - -
- - - - - - - - openEditDialog( - shortener.code, - shortener.link, - shortener.projectId, - shortener.project?.name, - shortener.active, - )}> - Edit - - openDeleteDialog(shortener.code)} - class="text-destructive data-[highlighted]:bg-destructive"> - Delete - - - - -
-
-
- {/each} +{#await data.shorteners} +
+
-{:else} -
No Data
-{/if} +{:then shorteners} + {#if shorteners.length > 0} +
+ {#each shorteners as shortener} + + + + +
+ + {#if shortener.active} + + Active + {:else} + + Inactive + {/if} + + {shortener.project + ? shortener.project.name + : 'Uncategorized'} +
+
+ {shortener.link} +
+ +
+
+ + +
+ + + + + + + + openEditDialog( + shortener.code, + shortener.link, + shortener.projectId, + shortener.project?.name, + shortener.active, + )}> + Edit + + + openDeleteDialog(shortener.code)} + class="text-destructive data-[highlighted]:bg-destructive"> + Delete + + + + +
+
+
+ {/each} +
+ {:else} +
No Data
+ {/if} +{/await}