diff --git a/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts b/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts index 1b69c23dd..14dac24ba 100644 --- a/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts +++ b/dmp-frontend/src/app/ui/user-profile/user-profile.component.ts @@ -62,7 +62,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes nestedIndex = 0; tenants: Observable>; expandedPreferences: boolean = false; - + organisationsSingleAutoCompleteConfiguration: SingleAutoCompleteConfiguration; formGroup: UntypedFormGroup; @@ -96,11 +96,11 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes public getProviderIcons(userCredential: UserCredential, culture:string): string[] { - + if (userCredential.data.externalProviderNames === undefined || userCredential.data.externalProviderNames?.length === 0) { return [this.configurationService.authProviders.defaultAuthProvider.providerClass]; } - + const providerNames: string[] = []; for (let providerName of userCredential.data.externalProviderNames) { const providerImage = this.configurationService.authProviders.findOrGetDefault(providerName.toString(), culture).providerClass; @@ -141,19 +141,19 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes this.currentUserId = this.authService.userId()?.toString(); this.user = this.userService.getSingle( Guid.parse(this.currentUserId), - [ - nameof(x => x.id), - nameof(x => x.name), - nameof(x => x.additionalInfo.language), - nameof(x => x.additionalInfo.timezone), - nameof(x => x.additionalInfo.culture), - nameof(x => x.additionalInfo.organization), - nameof(x => x.additionalInfo.roleOrganization), - nameof(x => x.createdAt), - nameof(x => x.updatedAt), - nameof(x => x.hash), - `${nameof(x => x.credentials)}.${nameof(x => x.data.email)}`, - `${nameof(x => x.credentials)}.${nameof(x => x.data.externalProviderNames)}`, + [ + nameof(x => x.id), + nameof(x => x.name), + nameof(x => x.additionalInfo.language), + nameof(x => x.additionalInfo.timezone), + nameof(x => x.additionalInfo.culture), + nameof(x => x.additionalInfo.organization), + nameof(x => x.additionalInfo.roleOrganization), + nameof(x => x.createdAt), + nameof(x => x.updatedAt), + nameof(x => x.hash), + `${nameof(x => x.credentials)}.${nameof(x => x.data.email)}`, + `${nameof(x => x.credentials)}.${nameof(x => x.data.externalProviderNames)}`, ] ) .pipe(map(result => { @@ -167,10 +167,10 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes // "email": "dmpadmin@dmp.com", // "externalProviderNames": ["Google", "Facebook"] // } - // }; + // }; // result.credentials.push(fakecredentials); // result.credentials[0].data.externalProviderNames = ['Google']; - + this.userLanguage = result.additionalInfo.language; this.firstEmail = result.credentials[0].data.email; this.userCredentials = of(result.credentials); @@ -224,7 +224,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes if (culture == null || culture.displayName == null - || culture.nativeName == null) + || culture.nativeName == null) return undefined; return culture.displayName + '-' + culture.nativeName; @@ -323,7 +323,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes this.userService.removeCredentialAccount({ credentialId: userCredential.user.id }).subscribe(result => { //TODO }, - error => console.error(error)); + error => this.onCallbackError(error)); //TODO: refactor // const unlinkAccountModel: UnlinkAccountRequestModel = { @@ -373,7 +373,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes }); } }, - error => console.error(error)); //TODO how to handle this + error => this.onCallbackError(error)); //TODO how to handle this //TODO refactor