Skip to content

Commit

Permalink
conditional mentorConfig fix
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronshiel committed Sep 20, 2023
1 parent d3c5b76 commit 146de8d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions client/src/hooks/graphql/use-with-setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ export function useWithSetup(search?: { i?: string }): UseWithSetup {
requiredSubjects,
isSetupComplete,
});
const mentorSubjectsLocked = mentor.mentorConfig.subjects.length;
const mentorSubjectsLocked = mentor.mentorConfig?.subjects.length;
const mentorPrivacyLocked =
mentor.mentorConfig.publiclyVisible !== undefined ||
mentor.mentorConfig.orgPermissions.length;
const mentorTypeLocked = mentor.mentorConfig.mentorType;
mentor.mentorConfig?.publiclyVisible !== undefined ||
mentor.mentorConfig?.orgPermissions.length;
const mentorTypeLocked = mentor.mentorConfig?.mentorType;
const status: SetupStep[] = [
{ type: SetupStepType.WELCOME, complete: true },
{ type: SetupStepType.MENTOR_INFO, complete: isMentorInfoDone },
Expand Down Expand Up @@ -249,7 +249,7 @@ export function useWithSetup(search?: { i?: string }): UseWithSetup {
if (!status) {
return;
}
if (mentor.mentorConfig.configId) {
if (mentor.mentorConfig?.configId) {
// TODO: need to update the way we navigate setup via url, should not
// be hardcoded carousel indexes, should instead be based off the SetupStepType
navigate("/setup");
Expand Down
2 changes: 1 addition & 1 deletion client/src/types-gql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface MentorGQL {
isPrivate: boolean;
isArchived: boolean;
isAdvanced: boolean;
mentorConfig: MentorConfig;
mentorConfig?: MentorConfig;
orgPermissions: OrgPermission[];
defaultSubject?: SubjectGQL;
subjects: SubjectGQL[];
Expand Down
2 changes: 1 addition & 1 deletion client/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ export interface Mentor {
isPrivate: boolean;
isArchived: boolean;
isAdvanced: boolean;
mentorConfig: MentorConfig;
mentorConfig?: MentorConfig;
orgPermissions: OrgPermission[];
defaultSubject?: Subject;
subjects: Subject[];
Expand Down

0 comments on commit 146de8d

Please sign in to comment.