From 7373a25a84292d429c70d346df3ce5a7c67bdbaa Mon Sep 17 00:00:00 2001 From: "Federico Pasqua (eisterman)" Date: Wed, 19 Mar 2025 13:57:09 +0100 Subject: [PATCH] Basic User List --- src/routes/user/list/+page.svelte | 30 ++++++++++++++++++++++++++++++ src/routes/user/list/+page.ts | 12 ++++++++++++ src/routes/user/list/types.ts | 4 ++++ 3 files changed, 46 insertions(+) create mode 100644 src/routes/user/list/+page.svelte create mode 100644 src/routes/user/list/+page.ts create mode 100644 src/routes/user/list/types.ts diff --git a/src/routes/user/list/+page.svelte b/src/routes/user/list/+page.svelte new file mode 100644 index 0000000..7716ea0 --- /dev/null +++ b/src/routes/user/list/+page.svelte @@ -0,0 +1,30 @@ + + +
+
+ + + + + + + + + + + + {#each data.users as user (user.id)} + + + + + + {/each} + +
UsernameActions?
{user.id}{user.username}futures?
+
+
\ No newline at end of file diff --git a/src/routes/user/list/+page.ts b/src/routes/user/list/+page.ts new file mode 100644 index 0000000..7c7f948 --- /dev/null +++ b/src/routes/user/list/+page.ts @@ -0,0 +1,12 @@ +import type { PageLoad } from './$types'; +import type { UserShort } from "./types"; + +export const load: PageLoad = async ({ fetch }) => { + const res = await fetch("/api/internal/current/users/?limit=100&is_readonly=0", { + headers: { + 'Accept': 'application/json', + } + }); + const users: UserShort[] = await res.json(); + return { users }; +}; \ No newline at end of file diff --git a/src/routes/user/list/types.ts b/src/routes/user/list/types.ts new file mode 100644 index 0000000..2dde232 --- /dev/null +++ b/src/routes/user/list/types.ts @@ -0,0 +1,4 @@ +export type UserShort = { + id: number, + username: string +} \ No newline at end of file