From c27c81f39c002182c13e2023810d99f38bef71f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=98=99=E2=97=A6=20The=20Tablet=20=E2=9D=80=20GamerGirla?= =?UTF-8?q?ndCo=20=E2=97=A6=E2=9D=A7?= Date: Wed, 6 Dec 2023 21:37:54 -0500 Subject: [PATCH] refactor(api/utils): update isAdmin check make it also check that the user is logged in; eliminates need to type `isLoggedIn()` on the previous line --- lib/server/middlewareButNotReally/isAdmin.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/server/middlewareButNotReally/isAdmin.ts b/lib/server/middlewareButNotReally/isAdmin.ts index a109b0b..0a882c6 100644 --- a/lib/server/middlewareButNotReally/isAdmin.ts +++ b/lib/server/middlewareButNotReally/isAdmin.ts @@ -1,6 +1,8 @@ import { H3Event, EventHandlerRequest } from "h3"; import { messages } from "../constants"; +import isLoggedIn from "./isLoggedIn"; export default function (ev: H3Event) { + isLoggedIn(ev); if (!ev.context.currentUser?.profile.isAdmin) { throw createError({ statusCode: 403,