I have a NGRX Effect that saves a report, after the report is saved I want to reset the form and display a notification that the report was saved.
Below is an example of the store dispatching a effect to save the report and inject it into the store.
After it was saved and inserted, I want to reset the form and display a notification to the user.
onSubmit(): void {
// Gather the fields from the form and
// dispatch the new report event which will
// save the report and insert it into the store
const formModel = this.reportForm.value;
this.store.dispatch(new AddReport(formModel));
// After the report is saved, reset the form and
// display a notification to the user it was saved
this.reportForm.markAsPristine();
this.snackbar.open('Report Saved!', null, { duration: 700 });
}
The issue is I want to only reset the form and show the notification if the report was saved by the backend. Whats the best way to accomplish this.