feat(api/utils): add isadmin check

This commit is contained in:
parent a2300d959c
commit 1338e87238
Signed by: tablet
GPG Key ID: 924A5F6AF051E87C

@ -0,0 +1,10 @@
import { H3Event, EventHandlerRequest } from "h3";
import { messages } from "../constants";
export default function (ev: H3Event<EventHandlerRequest>) {
if (!ev.context.currentUser?.profile.isAdmin) {
throw createError({
statusCode: 403,
statusMessage: messages[403],
});
}
}