2024-11-09 19:05:28 +00:00
|
|
|
import { notSignedInMessage } from '$lib/flashMessages';
|
|
|
|
|
import { redirect } from 'sveltekit-flash-message/server';
|
|
|
|
|
import type { PageServerLoad } from './$types';
|
2024-03-15 19:05:47 +00:00
|
|
|
|
|
|
|
|
export const load: PageServerLoad = async (event) => {
|
2024-11-09 19:05:28 +00:00
|
|
|
const { locals } = event;
|
2024-09-01 19:22:00 +00:00
|
|
|
|
2024-11-09 19:05:28 +00:00
|
|
|
const authedUser = await locals.getAuthedUser();
|
2024-09-01 19:22:00 +00:00
|
|
|
if (!authedUser) {
|
2024-11-09 19:05:28 +00:00
|
|
|
throw redirect(302, '/login', notSignedInMessage, event);
|
2024-03-15 19:05:47 +00:00
|
|
|
}
|
|
|
|
|
|
2024-09-01 19:22:00 +00:00
|
|
|
// const users = await db.query.users.findMany({
|
|
|
|
|
// limit: 10,
|
|
|
|
|
// offset: 0,
|
|
|
|
|
// });
|
2024-03-15 19:05:47 +00:00
|
|
|
|
|
|
|
|
return {
|
2024-09-01 19:22:00 +00:00
|
|
|
// users,
|
2024-11-09 19:05:28 +00:00
|
|
|
};
|
|
|
|
|
};
|