how to subscribe to action success callback using ngrx and effects

后端 未结 6 1513
慢半拍i
慢半拍i 2020-12-07 17:43

I\'m trying to do simple thing - after some entity saved (using http request) I want to navigate back to list route. The problem is : how to subscribe to success action (or

6条回答
  •  日久生厌
    2020-12-07 18:13

    Angular, Angular... Yet another plugin to be included each time you need something different... :)

    But in the given case, seems like it's possible to do that without effects. The same approach as mentioned by @kuncevic-dev

    this.store.select(state => state.CompanyLicencesState).pipe(takeUntil(this.destroy)).subscribe((state: CompanyLicences.State) => {
      ...
    });
    this.store.dispatch(new GetCompanyLicences(filter)).pipe(finalize(() => (this.companyLicencsLoading = false)), takeUntil(this.destroy)).subscribe(() => {
      ...
    });
    

    Will do the work.

提交回复
热议问题