From 9adc0087fdf8ee5a4f467d115b9e4bd9e3beec7e Mon Sep 17 00:00:00 2001 From: Elinor Date: Mon, 8 Aug 2022 12:34:29 +0300 Subject: [PATCH] Fix: Return undefined when account type is not established (#2000) --- .../actions/profile-action-creators.ts | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/src/app/services/actions/profile-action-creators.ts b/src/app/services/actions/profile-action-creators.ts index 47ac3f07c..3df642a0d 100644 --- a/src/app/services/actions/profile-action-creators.ts +++ b/src/app/services/actions/profile-action-creators.ts @@ -98,7 +98,7 @@ export async function getBetaProfile(): Promise { const profileType = getProfileType(userInfo); return { ageGroup, profileType }; } catch (error) { - return { ageGroup: 0, profileType: ACCOUNT_TYPE.MSA }; + return { ageGroup: 0, profileType: ACCOUNT_TYPE.UNDEFINED }; } } @@ -151,17 +151,14 @@ export async function getProfileResponse(): Promise { } 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 ''; + } }