Cancel in flight / ongoing network request - ngrx effects
@Effect() | |
getTabData$: Observable<Action> = this.actions$.pipe( | |
ofType<FetchTabData>(TabActions.FETCH_TAB_DATA), | |
switchMap(action => { | |
const tabType = action.payload; | |
return this.http | |
.get(`${environment.apiUrl}/api/tab/${tabType}`) | |
.pipe( | |
map((response: any) => { | |
return new FetchTabDataSuccess(response.data); | |
}), | |
catchError(error => of(new FetchTabDataFailure(error))) | |
); | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment