feat(api): add isLoggedIn utility function

for api routes which require authentication
This commit is contained in:
parent 1dcb1ae3f9
commit 2b0d478ca7
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

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