Skip to content

Commit

Permalink
Coalesce nulls when Hasura claims don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
coel committed Oct 8, 2024
1 parent 4b83d80 commit 0b6d306
Showing 1 changed file with 2 additions and 2 deletions.
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 0b6d306

Please sign in to comment.