mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
23 lines
476 B
TypeScript
23 lines
476 B
TypeScript
|
|
import { redirect } from "sveltekit-flash-message/server";
|
||
|
|
import type { PageServerLoad } from "./$types";
|
||
|
|
import { notSignedInMessage } from "$lib/flashMessages";
|
||
|
|
import db from "$lib/drizzle";
|
||
|
|
|
||
|
|
export const load: PageServerLoad = async (event) => {
|
||
|
|
|
||
|
|
// TODO: Ensure admin user
|
||
|
|
if (!event.locals.user) {
|
||
|
|
redirect(302, '/login', notSignedInMessage, event);
|
||
|
|
}
|
||
|
|
|
||
|
|
const users = await db.query
|
||
|
|
.users
|
||
|
|
.findMany({
|
||
|
|
limit: 10,
|
||
|
|
offset: 0
|
||
|
|
});
|
||
|
|
|
||
|
|
return {
|
||
|
|
users
|
||
|
|
};
|
||
|
|
};
|