Persisting changes SPA

Update the user in the client.

User service

Open user.service.ts and add a metod updateUser

updateUser(id: number, user: User): Observable<any> {
  return this.http
    .put(this.baseUrl + id, user)
    .pipe(catchError(this.handleError));
}

User component

In member-edit.component.ts make use of the new method.

updateUser() {
  this.userService.updateUser(this.authService.getUserId(), this.user).subscribe(
    _ => {
      this.editForm.reset(this.user);
      this.alertify.success('Profile updated succesfully');
    },
    error => {
      this.alertify.success(error);
    }
  );
}