mirror of
https://github.com/BradNut/boredgame
synced 2025-09-08 17:40:22 +00:00
22 lines
558 B
TypeScript
22 lines
558 B
TypeScript
import { redirect } from 'sveltekit-flash-message/server';
|
|
import type { PageServerLoad } from './$types';
|
|
import { notSignedInMessage } from '$lib/flashMessages';
|
|
import db from '../../../../../db';
|
|
import { userFullyAuthenticated } from '$lib/server/auth-utils';
|
|
|
|
export const load: PageServerLoad = async (event) => {
|
|
const { locals } = event;
|
|
const { user, session } = locals;
|
|
if (userFullyAuthenticated(user, session)) {
|
|
return fail(401);
|
|
}
|
|
|
|
const users = await db.query.users.findMany({
|
|
limit: 10,
|
|
offset: 0,
|
|
});
|
|
|
|
return {
|
|
users,
|
|
};
|
|
};
|