Created
February 8, 2019 10:35
-
-
Save vvscode/f072c49ad3c96608706a1856db83a88e to your computer and use it in GitHub Desktop.
handle-api-call-state-nicely
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export enum NewsActionsTypes { | |
Load = '[NEWS PAGE] LOAD NEWS', | |
LoadSuccess = '[NEWS PAGE] LOAD NEWS SUCCESS', | |
LoadError = '[NEWS PAGE] LOAD NEWS ERROR', | |
} | |
export class LoadNews implements Action { | |
readonly type = NewsActionsTypes.Load; | |
} | |
export class LoadNewsSuccess implements Action { | |
readonly type = NewsActionsTypes.LoadSuccess; | |
constructor(public payload: {entities: string[]}) {} | |
} | |
export class LoadNewsError implements Action { | |
readonly type = NewsActionsTypes.LoadError; | |
constructor(public error: any) {} | |
} | |
export type NewsActions = LoadNews | LoadNewsSuccess | LoadNewsError |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment