/user-profile.component.ts Secret
Created
June 12, 2024 12:08
use tapResponseBody operator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected saveUserData() { | |
// set the saving flag | |
this.isSaveRequestInProgress = true; | |
this.saveUserData$() | |
.pipe( | |
finalize(...), | |
tapResponseBody(body => { | |
// store the user data | |
this.userData = body!.data | |
// update the form with the values received from the server | |
this.restoreForm(); | |
// display a success notification | |
this.notification.display('The profile was successfully saved'); | |
}), | |
// handle server-side validation errors | |
tapValidationErrors(...), | |
tapUploadProgress(...), | |
catchError(...) | |
) | |
.subscribe() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment