1 | import { HttpErrorResponse } from '@angular/common/http';
|
---|
2 | import { Action } from '@ngrx/store';
|
---|
3 | import { CategoryStateViewModel } from 'src/app/shared-app/models';
|
---|
4 |
|
---|
5 | export enum CategoryActionTypes {
|
---|
6 | GetCategoriesState = '[Category] Get state',
|
---|
7 | GetCategoriesStateSuccess = '[Category] Get state success',
|
---|
8 | AddCategory = '[Category] AddCategory',
|
---|
9 | AddCategorySuccess = '[Category] AddCategorySuccess success',
|
---|
10 | EffectStartedWorking = '[Category] Effect Started Working',
|
---|
11 | EffectFinishedWorking = '[Category] Effect Finished Working',
|
---|
12 | EffectFinishedWorkingError = '[Category] Effect Finished Working error'
|
---|
13 | }
|
---|
14 |
|
---|
15 | export class GetCategoriesState implements Action {
|
---|
16 | readonly type = CategoryActionTypes.GetCategoriesState;
|
---|
17 |
|
---|
18 | constructor() {}
|
---|
19 | }
|
---|
20 |
|
---|
21 | export class GetCategoriesStateSuccess implements Action {
|
---|
22 | readonly type = CategoryActionTypes.GetCategoriesStateSuccess;
|
---|
23 |
|
---|
24 | constructor(public payload: CategoryStateViewModel[]) {}
|
---|
25 | }
|
---|
26 |
|
---|
27 | export class AddCategory implements Action {
|
---|
28 | readonly type = CategoryActionTypes.AddCategory;
|
---|
29 |
|
---|
30 | constructor(public name: string) {}
|
---|
31 | }
|
---|
32 |
|
---|
33 | export class AddCategorySuccess implements Action {
|
---|
34 | readonly type = CategoryActionTypes.AddCategorySuccess;
|
---|
35 |
|
---|
36 | constructor(public payload: CategoryStateViewModel) {}
|
---|
37 | }
|
---|
38 |
|
---|
39 | export class EffectStartedWorking implements Action {
|
---|
40 | readonly type = CategoryActionTypes.EffectStartedWorking;
|
---|
41 |
|
---|
42 | constructor() {}
|
---|
43 | }
|
---|
44 |
|
---|
45 | export class EffectFinishedWorking implements Action {
|
---|
46 | readonly type = CategoryActionTypes.EffectFinishedWorking;
|
---|
47 |
|
---|
48 | constructor() {}
|
---|
49 | }
|
---|
50 |
|
---|
51 | export class EffectFinishedWorkingError implements Action {
|
---|
52 | readonly type = CategoryActionTypes.EffectFinishedWorkingError;
|
---|
53 |
|
---|
54 | constructor(public payload: HttpErrorResponse) {}
|
---|
55 | }
|
---|
56 |
|
---|
57 | export type CategoryAction =
|
---|
58 | | GetCategoriesStateSuccess
|
---|
59 | | AddCategorySuccess
|
---|
60 | | EffectStartedWorking
|
---|
61 | | EffectFinishedWorking
|
---|
62 | | EffectFinishedWorkingError;
|
---|