mirror of https://github.com/buster-so/buster.git
user organization can be null
This commit is contained in:
parent
de85b20627
commit
f07d5425b9
|
@ -67,7 +67,7 @@ export interface BusterUser {
|
|||
export interface BusterUserResponse {
|
||||
user: BusterUser;
|
||||
teams: BusterUserTeam[];
|
||||
organizations: BusterOrganization[];
|
||||
organizations: BusterOrganization[] | null;
|
||||
}
|
||||
|
||||
export interface BusterOrganization {
|
||||
|
|
|
@ -26,7 +26,7 @@ export default async function Layout({
|
|||
const newUserRoute = createBusterRoute({ route: BusterAppRoutes.NEW_USER });
|
||||
|
||||
if (
|
||||
(!userInfo?.organizations[0]?.id || !userInfo?.user?.name) &&
|
||||
(!userInfo?.organizations?.[0]?.id || !userInfo?.user?.name) &&
|
||||
!cookiePathname?.includes(newUserRoute) &&
|
||||
pathname !== newUserRoute &&
|
||||
supabaseContext.accessToken //added to avoid bug with anon user
|
||||
|
|
|
@ -26,7 +26,7 @@ export const useUserConfigProvider = ({ userInfo }: { userInfo: BusterUserRespon
|
|||
|
||||
const user = userResponse?.user;
|
||||
const userTeams = userResponse?.teams || [];
|
||||
const userOrganizations = userResponse?.organizations[0];
|
||||
const userOrganizations = userResponse?.organizations?.[0];
|
||||
const userRole = userOrganizations?.role;
|
||||
const isUserRegistered =
|
||||
!!userResponse && !!userResponse?.organizations?.[0]?.id && !!userResponse?.user?.name;
|
||||
|
|
Loading…
Reference in New Issue