This commit is contained in:
Rodolfo Martinez 2025-12-05 12:24:07 -05:00
parent 81f60acd06
commit 8380cb8e6a
36 changed files with 5342 additions and 4434 deletions

View file

@ -94,7 +94,6 @@ const VerifySuccess = () => {
timerRef.current = setInterval(() => {
setCountdown((prev) => {
if (prev <= 1) {
navigate("/login");
return 0;
}
return prev - 1;
@ -106,8 +105,18 @@ const VerifySuccess = () => {
clearInterval(timerRef.current);
}
};
}, []); // eslint-disable-line react-hooks/exhaustive-deps
// navigate is stable but we only want this to run once on mount
}, []);
// Separate effect to handle navigation when countdown reaches 0
useEffect(() => {
if (countdown === 0) {
// Clear session storage before redirecting
sessionStorage.removeItem("registrationResult");
sessionStorage.removeItem("registeredEmail");
sessionStorage.removeItem("userRole");
navigate("/login");
}
}, [countdown, navigate]);
const getUserRoleText = useCallback((role) => {
switch (role) {
@ -362,10 +371,11 @@ const VerifySuccess = () => {
onClick={handleGoToLogin}
variant="primary"
fullWidth
className="whitespace-nowrap"
>
<LockClosedIcon className="mr-2 h-5 w-5" />
Sign In Now
<ArrowRightIcon className="ml-2 h-4 w-4" />
<LockClosedIcon className="mr-2 h-5 w-5 inline-block" />
<span className="inline-block">Sign In Now</span>
<ArrowRightIcon className="ml-2 h-4 w-4 inline-block" />
</Button>
</div>
</div>