Skip to content

Commit

Permalink
Fix: Return undefined when account type is not established (#2000)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElinorW committed Aug 8, 2022
1 parent 3c02478 commit 9adc008
Showing 1 changed file with 8 additions and 11 deletions.
19 changes: 8 additions & 11 deletions src/app/services/actions/profile-action-creators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export async function getBetaProfile(): Promise<IBetaProfile> {
const profileType = getProfileType(userInfo);
return { ageGroup, profileType };
} catch (error) {
return { ageGroup: 0, profileType: ACCOUNT_TYPE.MSA };
return { ageGroup: 0, profileType: ACCOUNT_TYPE.UNDEFINED };
}
}

Expand Down Expand Up @@ -151,17 +151,14 @@ export async function getProfileResponse(): Promise<IProfileResponse> {
}

export async function getTenantInfo(profileType: ACCOUNT_TYPE) {
if(profileType===ACCOUNT_TYPE.AAD) {
try{
query.sampleUrl = USER_ORGANIZATION_URL;
const { userInfo: tenant } = await getProfileResponse();
return tenant.value[0]?.displayName;
} catch (error: any) {
return '';
}
}
if(profileType===ACCOUNT_TYPE.MSA) {
return 'Personal';
}
return '';
try{
query.sampleUrl = USER_ORGANIZATION_URL;
const { userInfo: tenant } = await getProfileResponse();
return tenant.value[0]?.displayName;
} catch (error: any) {
return '';
}
}

0 comments on commit 9adc008

Please sign in to comment.