Skip to content

Instantly share code, notes, and snippets.

@cezar-plescan
Created June 12, 2024 12:08
use tapResponseBody operator
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