Skip to content

Commit

Permalink
fix hook if search parameter is an org ID of org user is not authoriz…
Browse files Browse the repository at this point in the history
…ed to use
  • Loading branch information
dpgraham4401 committed Aug 4, 2024
1 parent 97fd213 commit 8dfd074
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/app/hooks/useOrg/useOrg.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ export const useOrg = () => {
// If an orgId is set, and we have the users orgs, check if the orgId is valid, remove otherwise
if (orgIdSearchParam && orgs) {
if (!orgs.find((org) => org.slug === orgSlug)) {
searchParams.delete('org');
const defaultOrg = orgs[0].slug;
searchParams.set('org', defaultOrg);
setSearchParams(searchParams);
setOrgSlugState(defaultOrg);
}
}

Expand Down

0 comments on commit 8dfd074

Please sign in to comment.