Created
June 26, 2020 16:45
-
-
Save kingsley-einstein/94190374e20a48f229323b7808b18b8f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { Action } from '@ngrx/store'; | |
import { Post } from '../../../models'; | |
export enum PostActionTypes { | |
LoadPostPing = '[Post] Ping To Load A Post', | |
LoadPostsPing = '[Post] Ping To Load All Posts', | |
LoadPost = '[Post] Load A Post', | |
LoadPosts = '[Post] Load All Posts' | |
} | |
export class LoadPostActionPing implements Action { | |
readonly type = PostActionTypes.LoadPostPing; | |
constructor(public payload: number) {} | |
} | |
export class LoadPostsActionPing implements Action { | |
readonly type = PostActionTypes.LoadPostsPing; | |
} | |
export class LoadPostAction implements Action { | |
readonly type = PostActionTypes.LoadPost; | |
constructor(public payload: { | |
data: Post | |
}) { | |
} | |
} | |
export class LoadPostsAction implements Action { | |
readonly type = PostActionTypes.LoadPosts; | |
constructor(public payload: { | |
data: Post[] | |
}) { | |
} | |
} | |
export type PostActionUnion = LoadPostAction | LoadPostsAction | LoadPostActionPing | LoadPostsActionPing; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment