Author Date Email Last Last import { Injectable } from '@angular/core' ; import { Store } from '@ngrx/store' ; import { Observable } from 'rxjs' ; import { AppStoreService } from '@app/@store/app.store.service' ; import { AppState } from '@app/@store/app.state' ; import * as items from '@app/features/todos/store/todos.actions' ; import { ITodosState } from '@app/features/todos/store/todos.state' ; import { map } from 'rxjs/operators' ; import { ITodo } from '@app/shared/models/todos/todos.model' ; @ Injectable ( { providedIn : 'root' } ) export class TodosStoreService extends AppStoreService { protected readonly STATE = 'todos' ; constructor ( protected store ) { super ( ) ; } dispatchLoadAction ( params = { } ) { this . dispatchAction ( new items . LoadAction ( params ) ) ; } dispatchCreateAction ( record ) { this . dispatchAction ( new items . CreateAction ( record ) ) ; } dispatchUpdateAction ( record ) { this . dispatchAction ( new items . UpdateAction ( record ) ) ; } dispatchRemoveAction ( id ) { this . dispatchAction ( new items . RemoveAction ( id ) ) ; } dispatchErrorAction ( error ) { this . dispatchAction ( new items . ErrorAction ( error ) ) ; } getTodos ( ) { return this . storeSelectFeatureState ( ) . pipe ( map ( ( state ) => state ) ) ; } findById ( record ) { return this . getTodos ( ) . pipe ( map ( ( state ) => state . find ( ( item ) => item . _id === record . _id ) ) ) ; } }