You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

22 lines
483 B

export default defineEventHandler(async (event) => {
const session = await useWGSession(event);
if (!session.data.userId) {
throw createError({
statusCode: 401,
statusMessage: 'Not logged in',
});
}
const user = await Database.user.findById(session.data.userId);
if (!user) {
throw createError({
statusCode: 404,
statusMessage: 'Not found in Database',
});
}
return {
role: user.role,
username: user.username,
};
});