user-profile > unlink account

This commit is contained in:
Sofia Papacharalampous 2024-03-26 15:57:59 +02:00
parent dff8785e7b
commit 8be851763b
4 changed files with 22 additions and 3 deletions

View File

@ -50,7 +50,7 @@ public class RemoveCredentialRequestPersist {
protected List<Specification> specifications(RemoveCredentialRequestPersist item) {
return Arrays.asList(
this.spec()
.must(() -> !this.isValidGuid(item.getCredentialId()))
.must(() -> this.isValidGuid(item.getCredentialId()))
.failOn(RemoveCredentialRequestPersist._credentialId).failWith(messageSource.getMessage("Validation_Required", new Object[]{RemoveCredentialRequestPersist._credentialId}, LocaleContextHolder.getLocale()))
);
}

View File

@ -79,3 +79,7 @@ export interface DmpAssociatedUser {
export interface UserMergeRequestPersist {
email: string;
}
export interface RemoveCredentialRequestPersist {
credentialId: Guid;
}

View File

@ -1,7 +1,7 @@
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
import { Injectable } from '@angular/core';
import { IsActive } from '@app/core/common/enum/is-active.enum';
import { DmpAssociatedUser, User, UserMergeRequestPersist, UserPersist, UserRolePatchPersist } from '@app/core/model/user/user';
import { DmpAssociatedUser, RemoveCredentialRequestPersist, User, UserMergeRequestPersist, UserPersist, UserRolePatchPersist } from '@app/core/model/user/user';
import { UserLookup } from '@app/core/query/user.lookup';
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
@ -107,6 +107,16 @@ export class UserService {
catchError((error: any) => throwError(error)));
}
removeCredentialAccount(item: RemoveCredentialRequestPersist): Observable<boolean> {
const url = `${this.apiBase}/mine/remove-credential-request`;
console.log(item);
console.log(url);
return this.http
.post<boolean>(url, item).pipe(
catchError((error: any) => throwError(error)));
}
confirmMergeAccount(token: Guid): Observable<boolean> {
const url = `${this.apiBase}/mine/confirm-merge-account/token/${token}`;

View File

@ -296,8 +296,13 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
.afterClosed()
.subscribe(confirm => {
if (confirm) {
this.userService.removeCredentialAccount({ credentialId: userCredential.user.id }).subscribe(result => {
//TODO
},
error => console.error(error));
//TODO: refactor
console.log('removed!');
// const unlinkAccountModel: UnlinkAccountRequestModel = {
// userId: this.currentUserId,
// email: userCredential.email,