From cb4c8accea05a47fa47606b6df17043e052e1910 Mon Sep 17 00:00:00 2001 From: Mike Cao Date: Tue, 13 Dec 2022 08:41:13 -0800 Subject: [PATCH] Fixed admin checks. --- pages/api/users/[id]/index.ts | 2 +- pages/api/users/index.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/api/users/[id]/index.ts b/pages/api/users/[id]/index.ts index cd0332d5..bbf2e7cb 100644 --- a/pages/api/users/[id]/index.ts +++ b/pages/api/users/[id]/index.ts @@ -70,7 +70,7 @@ export default async ( } if (req.method === 'DELETE') { - if (isAdmin) { + if (!isAdmin) { return unauthorized(res); } diff --git a/pages/api/users/index.ts b/pages/api/users/index.ts index 09f901c0..4abe4353 100644 --- a/pages/api/users/index.ts +++ b/pages/api/users/index.ts @@ -23,7 +23,7 @@ export default async ( } = req.auth; if (req.method === 'GET') { - if (isAdmin) { + if (!isAdmin) { return unauthorized(res); } @@ -33,7 +33,7 @@ export default async ( } if (req.method === 'POST') { - if (isAdmin) { + if (!isAdmin) { return unauthorized(res); }