next/lib/server/middlewareButNotReally/isLoggedIn.ts

11 lines
271 B
TypeScript
Raw Normal View History

import { H3Event, EventHandlerRequest } from "h3";
import { messages } from "../constants";
export default function (ev: H3Event<EventHandlerRequest>) {
if (!ev.context.currentUser) {
throw createError({
statusCode: 401,
statusMessage: messages[401],
});
}
}