diff --git a/src/frontend/KindeBrowserClient.js b/src/frontend/KindeBrowserClient.js index 136f1301..0c62c0fb 100644 --- a/src/frontend/KindeBrowserClient.js +++ b/src/frontend/KindeBrowserClient.js @@ -23,7 +23,7 @@ export const useKindeBrowserClient = ( organization: null, permissions: [], user: null, - userOrganizations: [] + userOrganizations: null }); useEffect(() => { diff --git a/src/session/getUserOrganizations.ts b/src/session/getUserOrganizations.ts index e54b89fd..120d14f9 100644 --- a/src/session/getUserOrganizations.ts +++ b/src/session/getUserOrganizations.ts @@ -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],