modify login

This commit is contained in:
mohadeseh safari committed 2025-04-21 16:06:44 -04:00
1 parent f3e6dec937
commit c0adbb5bd7
1 file changed
+19 -11
+19 -11
View File
@@ -58,16 +58,24 @@ const Login = () => {
setBackendReachable(isReachable); setBackendReachable(isReachable);
if (isReachable) { if (isReachable) {
networkService // Only check if super admin exists if not already attempting to log in
.doesSuperAdminExist() // This allows users to log in even if system thinks no super admin exists
.then((response) => { if (window.location.pathname === "/" || window.location.pathname === "") {
if (response.data.data === false) { networkService
navigate("/register"); .doesSuperAdminExist()
} .then((response) => {
}) if (response.data.data === false) {
.catch((error) => { // Add a toast notification instead of forcing redirect
logger.error(error); createToast({
}); body: t("noSuperAdminMessage"),
type: "info"
});
}
})
.catch((error) => {
logger.error(error);
});
}
// Only show reconnection toast if this was a retry attempt // Only show reconnection toast if this was a retry attempt
if (isRetry) { if (isRetry) {
@@ -93,7 +101,7 @@ const Login = () => {
} finally { } finally {
setIsCheckingConnection(false); setIsCheckingConnection(false);
} }
}, [navigate, t]); }, [t]); // Removed navigate since we no longer use it within this function
// Function to handle retry button click // Function to handle retry button click
const handleRetry = () => checkConnectivity(true); const handleRetry = () => checkConnectivity(true);