Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save HansS/47f1fd10c80b0d9c1aee4e8bc5407389 to your computer and use it in GitHub Desktop.

Select an option

Save HansS/47f1fd10c80b0d9c1aee4e8bc5407389 to your computer and use it in GitHub Desktop.
ngrx-01 Entity Feature Store Module - Actions
import { Action } from '@ngrx/store';
import { MyModel } from '../../models';
export enum ActionTypes {
LOAD_REQUEST = '[My Feature] Load Request',
LOAD_FAILURE = '[My Feature] Load Failure',
LOAD_SUCCESS = '[My Feature] Load Success'
}
export class LoadRequestAction implements Action {
readonly type = ActionTypes.LOAD_REQUEST;
}
export class LoadFailureAction implements Action {
readonly type = ActionTypes.LOAD_FAILURE;
constructor(public payload: { error: string }) {}
}
export class LoadSuccessAction implements Action {
readonly type = ActionTypes.LOAD_SUCCESS;
constructor(public payload: { items: MyModel[] }) {}
}
export type Actions = LoadRequestAction | LoadFailureAction | LoadSuccessAction;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment