From c0adbb5bd7625bcac807a23813b725599e4309a6 Mon Sep 17 00:00:00 2001 From: mohadeseh safari Date: Mon, 21 Apr 2025 16:06:44 -0400 Subject: [PATCH] modify login --- client/src/Pages/Auth/Login/Login.jsx | 30 +++++++++++++++++---------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/client/src/Pages/Auth/Login/Login.jsx b/client/src/Pages/Auth/Login/Login.jsx index 7eaf4d441..0440d14b6 100644 --- a/client/src/Pages/Auth/Login/Login.jsx +++ b/client/src/Pages/Auth/Login/Login.jsx @@ -58,16 +58,24 @@ const Login = () => { setBackendReachable(isReachable); if (isReachable) { - networkService - .doesSuperAdminExist() - .then((response) => { - if (response.data.data === false) { - navigate("/register"); - } - }) - .catch((error) => { - logger.error(error); - }); + // Only check if super admin exists if not already attempting to log in + // This allows users to log in even if system thinks no super admin exists + if (window.location.pathname === "/" || window.location.pathname === "") { + networkService + .doesSuperAdminExist() + .then((response) => { + if (response.data.data === false) { + // Add a toast notification instead of forcing redirect + createToast({ + body: t("noSuperAdminMessage"), + type: "info" + }); + } + }) + .catch((error) => { + logger.error(error); + }); + } // Only show reconnection toast if this was a retry attempt if (isRetry) { @@ -93,7 +101,7 @@ const Login = () => { } finally { setIsCheckingConnection(false); } - }, [navigate, t]); + }, [t]); // Removed navigate since we no longer use it within this function // Function to handle retry button click const handleRetry = () => checkConnectivity(true);