diff --git a/frontend/src/routes/(app)/links/+page.server.ts b/frontend/src/routes/(app)/links/+page.server.ts
index c793421..7e65b17 100644
--- a/frontend/src/routes/(app)/links/+page.server.ts
+++ b/frontend/src/routes/(app)/links/+page.server.ts
@@ -7,10 +7,13 @@ export const load = (async (event) => {
const shorteners = await db.query.shortener.findMany({
with: {
visitor: true,
+ project: true,
},
where: (shortener, { eq, and, isNull }) =>
and(eq(shortener.userId, user.id), isNull(shortener.projectId)),
})
- return { shorteners }
+ const projects = await db.query.project.findMany()
+
+ return { shorteners, projects }
}) satisfies PageServerLoad
diff --git a/frontend/src/routes/(app)/links/+page.svelte b/frontend/src/routes/(app)/links/+page.svelte
index 3cce6cc..f4a1838 100644
--- a/frontend/src/routes/(app)/links/+page.svelte
+++ b/frontend/src/routes/(app)/links/+page.svelte
@@ -5,6 +5,7 @@
import * as Dialog from '$lib/components/ui/dialog'
import * as Card from '$lib/components/ui/card'
import * as DropdownMenu from '$lib/components/ui/dropdown-menu'
+ import * as Select from '$lib/components/ui/select'
import { Input } from '$lib/components/ui/input'
import { Label } from '$lib/components/ui/label'
import {
@@ -43,12 +44,14 @@
let editDialogOpen = false
let editShortenerCode = ''
let editShortenerLink = ''
+ let editShortenerCategory: any = undefined
let isEditLoading = false
const openEditDialog = (code: string, link: string) => {
editDialogOpen = true
editShortenerCode = code
editShortenerLink = link
+ editShortenerCategory = undefined
}
const editShortener = async (code: string, link: string) => {
@@ -57,6 +60,9 @@
method: 'put',
body: JSON.stringify({
link,
+ projectId: editShortenerCategory
+ ? editShortenerCategory.value
+ : undefined,
}),
})
await invalidateAll()
@@ -184,6 +190,22 @@
bind:value={editShortenerLink}
class="col-span-3" />
+
+
+
+
+
+
+
+ {#each data.projects as project}
+ {project.name}
+ {/each}
+
+
+