Basic User List

This commit is contained in:
2025-03-19 13:57:09 +01:00
parent fefb96daaa
commit 7373a25a84
3 changed files with 46 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
<script lang="ts">
import type { PageProps } from './$types';
let { data }: PageProps = $props();
</script>
<div class="w-full">
<div class="overflow-x-auto rounded-box border border-base-content/5 bg-base-100">
<table class="table">
<!-- head -->
<thead>
<tr>
<th></th>
<th>Username</th>
<th>Actions?</th>
</tr>
</thead>
<tbody>
<!-- rows -->
{#each data.users as user (user.id)}
<tr>
<th>{user.id}</th>
<td>{user.username}</td>
<td>futures?</td>
</tr>
{/each}
</tbody>
</table>
</div>
</div>

View File

@@ -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 };
};

View File

@@ -0,0 +1,4 @@
export type UserShort = {
id: number,
username: string
}