feat(api): add isLoggedIn utility function

for api routes which require authentication
This commit is contained in:
☙◦ The Tablet ❀ GamerGirlandCo ◦❧ 2023-10-02 16:20:13 -04:00
parent 1dcb1ae3f9
commit 2b0d478ca7
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

View File

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