user-profile > unlink account
This commit is contained in:
parent
dff8785e7b
commit
8be851763b
|
@ -50,7 +50,7 @@ public class RemoveCredentialRequestPersist {
|
||||||
protected List<Specification> specifications(RemoveCredentialRequestPersist item) {
|
protected List<Specification> specifications(RemoveCredentialRequestPersist item) {
|
||||||
return Arrays.asList(
|
return Arrays.asList(
|
||||||
this.spec()
|
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()))
|
.failOn(RemoveCredentialRequestPersist._credentialId).failWith(messageSource.getMessage("Validation_Required", new Object[]{RemoveCredentialRequestPersist._credentialId}, LocaleContextHolder.getLocale()))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,3 +79,7 @@ export interface DmpAssociatedUser {
|
||||||
export interface UserMergeRequestPersist {
|
export interface UserMergeRequestPersist {
|
||||||
email: string;
|
email: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export interface RemoveCredentialRequestPersist {
|
||||||
|
credentialId: Guid;
|
||||||
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http';
|
||||||
import { Injectable } from '@angular/core';
|
import { Injectable } from '@angular/core';
|
||||||
import { IsActive } from '@app/core/common/enum/is-active.enum';
|
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 { UserLookup } from '@app/core/query/user.lookup';
|
||||||
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
import { MultipleAutoCompleteConfiguration } from '@app/library/auto-complete/multiple/multiple-auto-complete-configuration';
|
||||||
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
import { SingleAutoCompleteConfiguration } from '@app/library/auto-complete/single/single-auto-complete-configuration';
|
||||||
|
@ -106,6 +106,16 @@ export class UserService {
|
||||||
.post<boolean>(url, item).pipe(
|
.post<boolean>(url, item).pipe(
|
||||||
catchError((error: any) => throwError(error)));
|
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> {
|
confirmMergeAccount(token: Guid): Observable<boolean> {
|
||||||
const url = `${this.apiBase}/mine/confirm-merge-account/token/${token}`;
|
const url = `${this.apiBase}/mine/confirm-merge-account/token/${token}`;
|
||||||
|
|
|
@ -296,8 +296,13 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
.afterClosed()
|
.afterClosed()
|
||||||
.subscribe(confirm => {
|
.subscribe(confirm => {
|
||||||
if (confirm) {
|
if (confirm) {
|
||||||
|
|
||||||
|
this.userService.removeCredentialAccount({ credentialId: userCredential.user.id }).subscribe(result => {
|
||||||
|
//TODO
|
||||||
|
},
|
||||||
|
error => console.error(error));
|
||||||
|
|
||||||
//TODO: refactor
|
//TODO: refactor
|
||||||
console.log('removed!');
|
|
||||||
// const unlinkAccountModel: UnlinkAccountRequestModel = {
|
// const unlinkAccountModel: UnlinkAccountRequestModel = {
|
||||||
// userId: this.currentUserId,
|
// userId: this.currentUserId,
|
||||||
// email: userCredential.email,
|
// email: userCredential.email,
|
||||||
|
|
Loading…
Reference in New Issue