fix(server/middleware): add guard against setting event.context.currentUser
to null
This commit is contained in:
parent
643c8b3c77
commit
84502b68b8
@ -14,6 +14,6 @@ export default defineEventHandler(async (event) => {
|
||||
useRuntimeConfig().jwt,
|
||||
) as jwt.JwtPayload;
|
||||
let user = await User.findById(toktok.id as number).exec();
|
||||
event.context.currentUser = user;
|
||||
if (user) event.context.currentUser = user;
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user