add on error callback
This commit is contained in:
parent
b0a156ce17
commit
9ffa86f3cb
|
@ -62,7 +62,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
nestedIndex = 0;
|
nestedIndex = 0;
|
||||||
tenants: Observable<Array<string>>;
|
tenants: Observable<Array<string>>;
|
||||||
expandedPreferences: boolean = false;
|
expandedPreferences: boolean = false;
|
||||||
|
|
||||||
organisationsSingleAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
organisationsSingleAutoCompleteConfiguration: SingleAutoCompleteConfiguration;
|
||||||
|
|
||||||
formGroup: UntypedFormGroup;
|
formGroup: UntypedFormGroup;
|
||||||
|
@ -96,11 +96,11 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
|
|
||||||
|
|
||||||
public getProviderIcons(userCredential: UserCredential, culture:string): string[] {
|
public getProviderIcons(userCredential: UserCredential, culture:string): string[] {
|
||||||
|
|
||||||
if (userCredential.data.externalProviderNames === undefined || userCredential.data.externalProviderNames?.length === 0) {
|
if (userCredential.data.externalProviderNames === undefined || userCredential.data.externalProviderNames?.length === 0) {
|
||||||
return [this.configurationService.authProviders.defaultAuthProvider.providerClass];
|
return [this.configurationService.authProviders.defaultAuthProvider.providerClass];
|
||||||
}
|
}
|
||||||
|
|
||||||
const providerNames: string[] = [];
|
const providerNames: string[] = [];
|
||||||
for (let providerName of userCredential.data.externalProviderNames) {
|
for (let providerName of userCredential.data.externalProviderNames) {
|
||||||
const providerImage = this.configurationService.authProviders.findOrGetDefault(providerName.toString(), culture).providerClass;
|
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.currentUserId = this.authService.userId()?.toString();
|
||||||
this.user = this.userService.getSingle(
|
this.user = this.userService.getSingle(
|
||||||
Guid.parse(this.currentUserId),
|
Guid.parse(this.currentUserId),
|
||||||
[
|
[
|
||||||
nameof<User>(x => x.id),
|
nameof<User>(x => x.id),
|
||||||
nameof<User>(x => x.name),
|
nameof<User>(x => x.name),
|
||||||
nameof<User>(x => x.additionalInfo.language),
|
nameof<User>(x => x.additionalInfo.language),
|
||||||
nameof<User>(x => x.additionalInfo.timezone),
|
nameof<User>(x => x.additionalInfo.timezone),
|
||||||
nameof<User>(x => x.additionalInfo.culture),
|
nameof<User>(x => x.additionalInfo.culture),
|
||||||
nameof<User>(x => x.additionalInfo.organization),
|
nameof<User>(x => x.additionalInfo.organization),
|
||||||
nameof<User>(x => x.additionalInfo.roleOrganization),
|
nameof<User>(x => x.additionalInfo.roleOrganization),
|
||||||
nameof<User>(x => x.createdAt),
|
nameof<User>(x => x.createdAt),
|
||||||
nameof<User>(x => x.updatedAt),
|
nameof<User>(x => x.updatedAt),
|
||||||
nameof<User>(x => x.hash),
|
nameof<User>(x => x.hash),
|
||||||
`${nameof<User>(x => x.credentials)}.${nameof<UserCredential>(x => x.data.email)}`,
|
`${nameof<User>(x => x.credentials)}.${nameof<UserCredential>(x => x.data.email)}`,
|
||||||
`${nameof<User>(x => x.credentials)}.${nameof<UserCredential>(x => x.data.externalProviderNames)}`,
|
`${nameof<User>(x => x.credentials)}.${nameof<UserCredential>(x => x.data.externalProviderNames)}`,
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
.pipe(map(result => {
|
.pipe(map(result => {
|
||||||
|
@ -167,10 +167,10 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
// "email": "dmpadmin@dmp.com",
|
// "email": "dmpadmin@dmp.com",
|
||||||
// "externalProviderNames": ["Google", "Facebook"]
|
// "externalProviderNames": ["Google", "Facebook"]
|
||||||
// }
|
// }
|
||||||
// };
|
// };
|
||||||
// result.credentials.push(fakecredentials);
|
// result.credentials.push(fakecredentials);
|
||||||
// result.credentials[0].data.externalProviderNames = ['Google'];
|
// result.credentials[0].data.externalProviderNames = ['Google'];
|
||||||
|
|
||||||
this.userLanguage = result.additionalInfo.language;
|
this.userLanguage = result.additionalInfo.language;
|
||||||
this.firstEmail = result.credentials[0].data.email;
|
this.firstEmail = result.credentials[0].data.email;
|
||||||
this.userCredentials = of(result.credentials);
|
this.userCredentials = of(result.credentials);
|
||||||
|
@ -224,7 +224,7 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
|
|
||||||
if (culture == null
|
if (culture == null
|
||||||
|| culture.displayName == null
|
|| culture.displayName == null
|
||||||
|| culture.nativeName == null)
|
|| culture.nativeName == null)
|
||||||
return undefined;
|
return undefined;
|
||||||
|
|
||||||
return culture.displayName + '-' + culture.nativeName;
|
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 => {
|
this.userService.removeCredentialAccount({ credentialId: userCredential.user.id }).subscribe(result => {
|
||||||
//TODO
|
//TODO
|
||||||
},
|
},
|
||||||
error => console.error(error));
|
error => this.onCallbackError(error));
|
||||||
|
|
||||||
//TODO: refactor
|
//TODO: refactor
|
||||||
// const unlinkAccountModel: UnlinkAccountRequestModel = {
|
// 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
|
//TODO refactor
|
||||||
|
|
Loading…
Reference in New Issue