import jwt from "jsonwebtoken" import { User } from "~/models/user" export default defineEventHandler(async (event) => { let ahead = getCookie(event, "rockfic_cookie") if(ahead) { let toktok = (jwt.verify(ahead.replace("Bearer ", ""), useRuntimeConfig().jwt) as jwt.JwtPayload) console.log(toktok) let user = await User.findById(toktok.id as number).exec() event.context.currentUser = user } })