56 lines
1 KiB
Svelte
56 lines
1 KiB
Svelte
<script lang="ts">
|
|
import Table from '$lib/components/data-table/Table.svelte';
|
|
import type { Column } from '$lib/components/data-table/types';
|
|
import { readUsers, readUserCount } from '$lib/api/endpoints';
|
|
|
|
const columns: Column[] = [
|
|
{
|
|
field: "id",
|
|
heading: "ID",
|
|
},
|
|
{
|
|
field: "email",
|
|
heading: "Email",
|
|
isLink: true,
|
|
linkTarget: '/users/%id%',
|
|
},
|
|
{
|
|
field: "first_name",
|
|
heading: "First Name",
|
|
},
|
|
{
|
|
field: "last_name",
|
|
heading: "Last Name",
|
|
},
|
|
{
|
|
field: "created",
|
|
heading: "Created",
|
|
type: 'date',
|
|
},
|
|
{
|
|
field: "updated",
|
|
heading: "Updated",
|
|
type: 'date',
|
|
},
|
|
{
|
|
field: "is_admin",
|
|
heading: "Admin",
|
|
type: 'boolean',
|
|
},
|
|
]
|
|
|
|
const table = {
|
|
caption: "List of users",
|
|
columns: columns,
|
|
getItemsEndpoint: {
|
|
callable: readUsers,
|
|
args: []
|
|
},
|
|
getItemCountEndpoint: {
|
|
callable: readUserCount,
|
|
args: []
|
|
}
|
|
};
|
|
</script>
|
|
|
|
<Table {...table} />
|