176. Reset password back end call (#25 Section 26: User Page - Reset Password)

This commit is contained in:
Art
2021-09-21 22:22:49 +03:00
parent cf3474f32e
commit 5708dda25e

View File

@ -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);
}
}