Add role base access control for events module
This commit is contained in:
@@ -1,9 +1,18 @@
|
||||
import type { LayoutServerLoad } from './$types'
|
||||
|
||||
export const load: LayoutServerLoad = async ({ locals: { safeGetSession }, cookies }) => {
|
||||
const { session } = await safeGetSession()
|
||||
export const load: LayoutServerLoad = async ({ locals: { safeGetSession, getUserProfile }, cookies }) => {
|
||||
const { session, user } = await safeGetSession()
|
||||
|
||||
// Get the user profile if the user is authenticated
|
||||
let profile = null
|
||||
if (user) {
|
||||
profile = await getUserProfile(user.id)
|
||||
}
|
||||
|
||||
return {
|
||||
session,
|
||||
user,
|
||||
profile,
|
||||
cookies: cookies.getAll(),
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user