Build Admin pages
This commit is contained in:
@@ -3,8 +3,13 @@ import { error } from '@sveltejs/kit';
|
||||
import { prisma } from '$lib/db';
|
||||
|
||||
export const load: LayoutServerLoad = async ({ locals }) => {
|
||||
const user = await prisma.user.findUnique({ where: { id: locals.user?.id } });
|
||||
const user = await prisma.user.findUnique({
|
||||
where: { id: locals.user?.id },
|
||||
select: { id: true, roleId: true }
|
||||
});
|
||||
if (!user) {
|
||||
throw error(403, 'not authorized');
|
||||
}
|
||||
|
||||
return { userRoleId: user.roleId };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user