next/lib/server/middlewareButNotReally/isLoggedIn.ts
2023-10-02 16:20:13 -04:00

10 lines
242 B
TypeScript

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