From 5708dda25e8b70a432d9a61f2f6a67181ff97aed Mon Sep 17 00:00:00 2001 From: Art Date: Tue, 21 Sep 2021 22:22:49 +0300 Subject: [PATCH] 176. Reset password back end call (#25 Section 26: User Page - Reset Password) --- .../src/app/component/user/user.component.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/support-portal-frontend/src/app/component/user/user.component.ts b/support-portal-frontend/src/app/component/user/user.component.ts index 9428437..7e14320 100644 --- a/support-portal-frontend/src/app/component/user/user.component.ts +++ b/support-portal-frontend/src/app/component/user/user.component.ts @@ -169,4 +169,23 @@ export class UserComponent implements OnInit, OnDestroy { ); this.subscriptions.push(subscription); } + + public onResetPassword(emailForm: NgForm): void { + this.refreshing = true; + let email = emailForm.value['']; + let subscription = this.userService.resetPassword(email) + .subscribe( + (response: CustomHttpResponse) => { + this.notificationService.notify(NotificationType.SUCCESS, response.message); + }, + (errorResponse: HttpErrorResponse) => { + this.sendErrorNotification(errorResponse.error.message); + }, + () => { + this.refreshing = false; + emailForm.reset(); + } + ); + this.subscriptions.push(subscription); + } }