Merge pull request #1866 from Infisical/daniel/fix-no-orgs-selectable

Fix: No orgs selectable if a user has been removed from an organization
This commit is contained in:
Daniel Hougaard
2024-05-23 15:19:13 +02:00
committed by GitHub

View File

@@ -121,6 +121,14 @@ export default function LoginPage() {
}
}, [router]);
// Case: User has no organizations.
// This can happen if the user was previously a member, but the organization was deleted or the user was removed.
useEffect(() => {
if (!organizations.isLoading && organizations.data?.length === 0) {
router.push("/org/none");
}
}, [organizations.isLoading, organizations.data]);
if (userLoading || !user) {
return <LoadingScreen />;
}