Build user pages
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
import type { LayoutServerLoad } from './$types';
|
||||
import { prisma } from '$lib/db';
|
||||
|
||||
export const load: LayoutServerLoad = async ({ locals }) => {
|
||||
if (!locals.user?.id) {
|
||||
return { userRoleId: null };
|
||||
}
|
||||
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: locals.user.id },
|
||||
select: { roleId: true }
|
||||
});
|
||||
|
||||
return { userRoleId: user?.roleId ?? null };
|
||||
};
|
||||
Reference in New Issue
Block a user