-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpost.action.ts
More file actions
49 lines (37 loc) · 1.16 KB
/
post.action.ts
File metadata and controls
49 lines (37 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
import {Action} from "@ngrx/store";
import {Post} from "../model/post.model.ts";
export const GET_POST_START = '[Post] Get Post Start';
export const CREATE_POST_START = '[Post] Create Post Start';
export const GET_POST_SUCCESS = '[POST] Get Post Success';
export const CREATE_POST_SUCCESS = '[Post] Create Post Success';
export const API_ERROR = '[Post] Post API Error';
export class GetPostStartAction implements Action {
readonly type = GET_POST_START;
constructor() {
}
}
export class CreatePostStartAction implements Action {
readonly type = CREATE_POST_START;
constructor(public payload: { title: string }) {
}
}
export class CreatePostSuccessAction implements Action {
readonly type = CREATE_POST_SUCCESS;
constructor(public payload: Post) {
}
}
export class GetPostSuccessAction implements Action {
readonly type = GET_POST_SUCCESS;
constructor(public payload: Post[]) {
}
}
export class ApiErrorAction implements Action {
readonly type = API_ERROR;
constructor(public payload: string) {
}
}
export type PostActionType =
GetPostStartAction
| CreatePostStartAction
| CreatePostSuccessAction
| GetPostSuccessAction | ApiErrorAction;