Skip to content

Instantly share code, notes, and snippets.

@wesleygrimes
Last active June 14, 2018 13:20
Show Gist options
  • Save wesleygrimes/3f44710f040dd8c1f52a6b49b8135ecf to your computer and use it in GitHub Desktop.
Save wesleygrimes/3f44710f040dd8c1f52a6b49b8135ecf to your computer and use it in GitHub Desktop.
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