From 8ec54c467bf06af0e8d2ecab94575faff4ea5022 Mon Sep 17 00:00:00 2001 From: Firman Ramdhani <33869609+firmanramdhani@users.noreply.github.com> Date: Thu, 3 Oct 2024 12:06:32 +0700 Subject: [PATCH] feat: set login only for superadmin --- src/apps/auth/pages/login/index.tsx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/apps/auth/pages/login/index.tsx b/src/apps/auth/pages/login/index.tsx index 4c84b09..92986ca 100644 --- a/src/apps/auth/pages/login/index.tsx +++ b/src/apps/auth/pages/login/index.tsx @@ -18,6 +18,17 @@ export default function LoginPage() { if (status === 201) { const user = data?.data; const role = user?.role; + if (role != 'superadmin') { + throw { + response: { + data: { + error: 'Unauthorized', + message: 'Gagal! username atau password tidak sesuai', + statusCode: 401, + }, + }, + }; + } await handleLogin(user); if (role === 'tenant') {