fix(server/middleware): add guard against setting event.context.currentUser to null

This commit is contained in:
parent 643c8b3c77
commit 84502b68b8
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -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;
}
});