Skip to content

Commit

Permalink
Fix: No orgs selectable if a user has been removed from an organization
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielHougaard committed May 23, 2024
1 parent 663f8ab commit 290d99e
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions frontend/src/pages/login/select-organization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 />;
}
Expand Down

0 comments on commit 290d99e

Please sign in to comment.