Options
All
  • Public
  • Public/Protected
  • All
Menu

Factory class for creating typed "CRUD" effects.

Type parameters

  • T

Hierarchy

  • EntityCrudEffect

Index

Constructors

constructor

  • new EntityCrudEffect(actions$: Actions, entitySchema: Entity): EntityCrudEffect
  • Constructs a new class of a typed CrudEffectFactory.

    Parameters

    • actions$: Actions

      The actions observable of an ngrx-store

    • entitySchema: Entity

      The normalizr schema to create effects for

    Returns EntityCrudEffect

Properties

Protected actions$

actions$: Actions

The actions observable of an ngrx-store

Private entityActions

entityActions: any

The ngrx-normalizr-crud actions

Protected entitySchema

entitySchema: Entity

The normalizr schema to create effects for

Private normalizrActions

normalizrActions: any

The ngrx-normalizr actions

Methods

createCreateEffect

  • createCreateEffect(actionHandler: function): Observable<Action>
  • Create an effect which will listen to the CREATE typed action and perform the given action handler. The result will be dispatched to an ngrx-normalizr AddData action and a CreateSuccess action with the handler result as payload. 'CreateFail' is dispatched with the error argument of the observables catch handler.

    Parameters

    • actionHandler: function

      The handler to call for creating entities

    Returns Observable<Action>

createDeleteEffect

  • createDeleteEffect(actionHandler: function): Observable<Action>
  • Create an effect which will listen to the DELETE typed action and perform the given action handler. The result will be dispatched to an ngrx-normalizr RemoveData action and an DeleteSuccess action with the handler result as payload. 'DeleteFail' is dispatched with the error argument of the observables catch handler.

    Parameters

    • actionHandler: function

      The handler to call for deleting an entity

    Returns Observable<Action>

Private createEffect

  • createEffect<T>(actionType: string, actionHandler: function, successActionCreator: function, errorActionCreator: function): Observable<Action>
  • Create a typed split effect

    Type parameters

    • T

    Parameters

    • actionType: string
    • actionHandler: function
        • (action: Action): Observable<T>
        • Parameters

          • action: Action

          Returns Observable<T>

    • successActionCreator: function
        • (result: T): [Action, Action]
        • Parameters

          • result: T

          Returns [Action, Action]

    • errorActionCreator: function
        • (error: any): Action
        • Parameters

          • error: any

          Returns Action

    Returns Observable<Action>

createSearchEffect

  • createSearchEffect(actionHandler: function): Observable<Action>
  • Create an effect which will listen to the SEARCH typed action and perform the given action handler. The result will be dispatched to an ngrx-normalizr AddData action and a SearchComplete action with the handler result as payload. 'SearchComplete' is dispatched with an empty array if any error occurs.

    Parameters

    • actionHandler: function

      The handler to call for searching entities

    Returns Observable<Action>

createUpdateEffect

  • createUpdateEffect(actionHandler: function): Observable<Action>
  • Create an effect which will listen to the UPDATE typed action and perform the given action handler. The result will be dispatched to an ngrx-normalizr AddData action and an UpdateSuccess action with the handler result as payload. 'UpdateFail' is dispatched with the error argument of the observables catch handler.

    Parameters

    • actionHandler: function

      The handler to call for creating entities

    Returns Observable<Action>

Generated using TypeDoc