1 | import { HttpErrorResponse } from '@angular/common/http';
|
---|
2 | import { Action } from '@ngrx/store';
|
---|
3 |
|
---|
4 | import { PreviewQuestionViewModel, QuestionStateViewModel } from 'src/app/shared-app/models';
|
---|
5 | import { PreviewQuestionResponse } from './question-state.models';
|
---|
6 |
|
---|
7 | export enum QuestionActionTypes {
|
---|
8 | GetQuestionState = '[Question] Get state',
|
---|
9 | GetQuestionStateSuccess = '[Question] Get state success',
|
---|
10 | GetPreviewQuestionsLatest = '[Question] Get preview questions Latest',
|
---|
11 | GetPreviewQuestionsLatestSuccess = '[Question] Get preview questions Latest Success',
|
---|
12 | GetPreviewQuestionsPopular = '[Question] Get preview questions Popular',
|
---|
13 | GetPreviewQuestionsPopularSuccess = '[Question] Get preview questions Popular Success',
|
---|
14 | EffectStartedWorking = '[Question] Effect Started Working',
|
---|
15 | EffectFinishedWorking = '[Question] Effect Finished Working',
|
---|
16 | EffectFinishedWorkingError = '[Question] Effect Finished Working error'
|
---|
17 | }
|
---|
18 |
|
---|
19 | export class GetQuestionState implements Action {
|
---|
20 | readonly type = QuestionActionTypes.GetQuestionState;
|
---|
21 |
|
---|
22 | constructor(public questionUid: string) {}
|
---|
23 | }
|
---|
24 |
|
---|
25 | export class GetQuestionStateSuccess implements Action {
|
---|
26 | readonly type = QuestionActionTypes.GetQuestionStateSuccess;
|
---|
27 |
|
---|
28 | constructor(public payload: QuestionStateViewModel) {}
|
---|
29 | }
|
---|
30 |
|
---|
31 | export class GetPreviewQuestionsLatest implements Action {
|
---|
32 | readonly type = QuestionActionTypes.GetPreviewQuestionsLatest;
|
---|
33 |
|
---|
34 | constructor() {}
|
---|
35 | }
|
---|
36 |
|
---|
37 | export class GetPreviewQuestionsLatestSuccess implements Action {
|
---|
38 | readonly type = QuestionActionTypes.GetPreviewQuestionsLatestSuccess;
|
---|
39 |
|
---|
40 | constructor(public payload: PreviewQuestionViewModel[]) {}
|
---|
41 | }
|
---|
42 |
|
---|
43 | export class GetPreviewQuestionsPopular implements Action {
|
---|
44 | readonly type = QuestionActionTypes.GetPreviewQuestionsPopular;
|
---|
45 |
|
---|
46 | constructor() {}
|
---|
47 | }
|
---|
48 |
|
---|
49 | export class GetPreviewQuestionsPopularSuccess implements Action {
|
---|
50 | readonly type = QuestionActionTypes.GetPreviewQuestionsPopularSuccess;
|
---|
51 |
|
---|
52 | constructor(public payload: PreviewQuestionViewModel[]) {}
|
---|
53 | }
|
---|
54 |
|
---|
55 | export class EffectStartedWorking implements Action {
|
---|
56 | readonly type = QuestionActionTypes.EffectStartedWorking;
|
---|
57 |
|
---|
58 | constructor() {}
|
---|
59 | }
|
---|
60 |
|
---|
61 | export class EffectFinishedWorking implements Action {
|
---|
62 | readonly type = QuestionActionTypes.EffectFinishedWorking;
|
---|
63 |
|
---|
64 | constructor() {}
|
---|
65 | }
|
---|
66 |
|
---|
67 | export class EffectFinishedWorkingError implements Action {
|
---|
68 | readonly type = QuestionActionTypes.EffectFinishedWorkingError;
|
---|
69 |
|
---|
70 | constructor(public payload: HttpErrorResponse) {}
|
---|
71 | }
|
---|
72 |
|
---|
73 | export type QuestionAction =
|
---|
74 | | GetQuestionStateSuccess
|
---|
75 | | GetPreviewQuestionsLatestSuccess
|
---|
76 | | GetPreviewQuestionsPopularSuccess
|
---|
77 | | EffectStartedWorking
|
---|
78 | | EffectFinishedWorking
|
---|
79 | | EffectFinishedWorkingError;
|
---|