Basic User List
This commit is contained in:
30
src/routes/user/list/+page.svelte
Normal file
30
src/routes/user/list/+page.svelte
Normal 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>
|
||||||
12
src/routes/user/list/+page.ts
Normal file
12
src/routes/user/list/+page.ts
Normal 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 };
|
||||||
|
};
|
||||||
4
src/routes/user/list/types.ts
Normal file
4
src/routes/user/list/types.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export type UserShort = {
|
||||||
|
id: number,
|
||||||
|
username: string
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user