import { Injectable } from '@angular/core';
import { State, Action, Actions, ofAction } from '@ngxs/store';
import { tap } from 'rxjs/operators';
constructor(private animalService: AnimalService, private actions$: Actions) {}
get(ctx: StateContext<ZooStateModel>, action: FeedAnimals) {
return this.animalService.get(action.payload).pipe(
tap((res) => ctx.setState(res)),
takeUntil(this.actions$.pipe(ofAction(RemoveTodo)))