14 lines
365 B
JavaScript
14 lines
365 B
JavaScript
|
export default defineEventHandler(async (event) => {
|
||
|
const user = await getAuth(event)
|
||
|
|
||
|
if (!user.role.moderator) return createError({ statusCode: 403, statusMessage: 'Gebruiker heeft geen toegang tot alle gebruikers' })
|
||
|
|
||
|
const usersColl = db.collection('users');
|
||
|
|
||
|
const cursor = usersColl.find()
|
||
|
|
||
|
const users = await cursor.toArray()
|
||
|
|
||
|
return users
|
||
|
});
|