Adding another effect

Now we are finally ready to construct our effect. It's going to look very similar to the existing one:

import { Injectable } from "@angular/core";import { HttpClient } from "@angular/common/http";import { Action } from "@ngrx/store";import { Actions, Effect, ofType } from "@ngrx/effects";import { Observable } from "rxjs/Observable";import { of } from "rxjs/observable/of";import "rxjs/add/observable/of";import {   catchError,   map,   mergeMap,   delay,   tap,   switchMap } from "rxjs/operators";import { FETCHING_PRODUCTS, ADD_PRODUCT } from "./product.constants";import {   fetchProductsSuccessfully,   fetchError,   addProductSuccessfully,   addProductError } from "./product.actions";import { Product } from "./product.model";

Get Architecting Angular Applications with Redux, RxJS, and NgRx now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.