Skip to content

Commit

Permalink
Merge pull request #217 from kinde-oss/leo/user_orgs
Browse files Browse the repository at this point in the history
Fix: coalesce nulls when Hasura claims don't exist
  • Loading branch information
DanielRivers authored Oct 9, 2024
2 parents 4a1ec2e + b283662 commit 07cfd56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/frontend/KindeBrowserClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useKindeBrowserClient = (
organization: null,
permissions: [],
user: null,
userOrganizations: []
userOrganizations: null
});

useEffect(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/session/getUserOrganizations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,13 @@ export const getUserOrganizationsFactory =
session,
'x-hasura-org-codes',
'id_token'
)) as string[];
)) as string[] ?? [];

const hasuraOrganizations = (await kindeClient.getClaimValue(
session,
'x-hasura-organizations',
'id_token'
)) as {id: string; name: string}[];
)) as {id: string; name: string}[] ?? [];

return {
orgCodes: [...userOrgs.orgCodes, ...hasuraOrgCodes],
Expand Down

0 comments on commit 07cfd56

Please sign in to comment.