Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save wesleygrimes/d7b660caedb80a35213dd55e8c63a9d5 to your computer and use it in GitHub Desktop.
Save wesleygrimes/d7b660caedb80a35213dd55e8c63a9d5 to your computer and use it in GitHub Desktop.
Standard Feature Store Module - Actions
import { Action } from '@ngrx/store';
import { User } from '../../models';
export enum ActionTypes {
LOGIN_REQUEST = '[My Feature] Login Request',
LOGIN_FAILURE = '[My Feature] Login Failure',
LOGIN_SUCCESS = '[My Feature] Login Success'
}
export class LoginRequestAction implements Action {
readonly type = ActionTypes.LOGIN_REQUEST;
constructor(public payload: { userName: string; password: string }) {}
}
export class LoginFailureAction implements Action {
readonly type = ActionTypes.LOGIN_FAILURE;
constructor(public payload: { error: string }) {}
}
export class LoginSuccessAction implements Action {
readonly type = ActionTypes.LOGIN_SUCCESS;
constructor(public payload: { user: User }) {}
}
export type Actions = LoginRequestAction | LoginFailureAction | LoginSuccessAction;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment