Skip to content

Commit

Permalink
using default value for registrationsOpen env var
Browse files Browse the repository at this point in the history
  • Loading branch information
SachdevJai committed Nov 15, 2024
1 parent 0296a47 commit 3f86b5a
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/pages/RegistrationForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,17 @@ function RegistrationForm({ isStudent }: { isStudent: boolean }) {
const [loading, setLoading] = useState<boolean>(false);

const [isRegistering, setIsRegistering] = useState(false);
const [registrationsOpen, setRegistrationsOpen] = useState(true);

const userType = isStudent ? "student" : "mentor";


if(REGISTRATIONS_OPEN === false) setRegistrationsOpen(false);

useEffect(() => {
setIsRegistering(!authContext.isRegistered);

if (isRegistering && !REGISTRATIONS_OPEN) {
if (isRegistering && !registrationsOpen) {
// Redirect if registrations are closed and is registering
navigate(ROUTER_PATHS.HOME);
}
Expand Down

0 comments on commit 3f86b5a

Please sign in to comment.