@zauru-sdk/redux 1.0.49 → 1.0.51

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (51) hide show
  1. package/dist/cjs/index.js +18 -0
  2. package/dist/{slices → cjs/slices}/agency.slice.js +8 -4
  3. package/dist/{slices → cjs/slices}/automaticNumbers.slice.js +8 -4
  4. package/dist/{slices → cjs/slices}/catalogs.slice.js +8 -4
  5. package/dist/cjs/slices/formValidation.slice.js +19 -0
  6. package/dist/cjs/slices/index.js +27 -0
  7. package/dist/{slices → cjs/slices}/profile.slice.js +8 -4
  8. package/dist/{slices → cjs/slices}/reception.slice.js +8 -4
  9. package/dist/cjs/slices/session.slice.js +16 -0
  10. package/dist/cjs/slices/tables.slice.js +20 -0
  11. package/dist/{slices → cjs/slices}/templates.slice.js +8 -4
  12. package/dist/{slices → cjs/slices}/user.slice.js +8 -4
  13. package/dist/cjs/slices/webapp-tables.slice.js +24 -0
  14. package/dist/{store.js → cjs/store.js} +46 -39
  15. package/dist/esm/index.js +18 -0
  16. package/dist/esm/slices/agency.slice.js +24 -0
  17. package/dist/esm/slices/automaticNumbers.slice.js +24 -0
  18. package/dist/esm/slices/catalogs.slice.js +65 -0
  19. package/dist/esm/slices/formValidation.slice.js +19 -0
  20. package/dist/esm/slices/index.js +27 -0
  21. package/dist/esm/slices/profile.slice.js +26 -0
  22. package/dist/esm/slices/reception.slice.js +61 -0
  23. package/dist/esm/slices/session.slice.js +16 -0
  24. package/dist/esm/slices/tables.slice.js +20 -0
  25. package/dist/esm/slices/templates.slice.js +23 -0
  26. package/dist/esm/slices/user.slice.js +42 -0
  27. package/dist/esm/slices/webapp-tables.slice.js +24 -0
  28. package/dist/esm/store.js +135 -0
  29. package/package.json +13 -11
  30. package/CHANGELOG.md +0 -184
  31. package/dist/index.js +0 -2
  32. package/dist/slices/formValidation.slice.js +0 -16
  33. package/dist/slices/index.js +0 -11
  34. package/dist/slices/session.slice.js +0 -13
  35. package/dist/slices/tables.slice.js +0 -17
  36. package/dist/slices/webapp-tables.slice.js +0 -20
  37. package/src/index.ts +0 -3
  38. package/src/slices/agency.slice.ts +0 -32
  39. package/src/slices/automaticNumbers.slice.ts +0 -41
  40. package/src/slices/catalogs.slice.ts +0 -178
  41. package/src/slices/formValidation.slice.ts +0 -32
  42. package/src/slices/index.ts +0 -11
  43. package/src/slices/profile.slice.ts +0 -49
  44. package/src/slices/reception.slice.ts +0 -118
  45. package/src/slices/session.slice.ts +0 -25
  46. package/src/slices/tables.slice.ts +0 -33
  47. package/src/slices/templates.slice.ts +0 -34
  48. package/src/slices/user.slice.ts +0 -64
  49. package/src/slices/webapp-tables.slice.ts +0 -35
  50. package/src/store.ts +0 -162
  51. package/tsconfig.json +0 -24
@@ -1,32 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
- import { AgencyGraphQL } from "@zauru-sdk/types";
4
-
5
- export interface AgencyState {
6
- agencyProfile: AgencyGraphQL;
7
- loadingAgencyProfile: boolean;
8
- }
9
-
10
- const initialState: AgencyState = {
11
- agencyProfile: {} as AgencyGraphQL,
12
- loadingAgencyProfile: false,
13
- };
14
-
15
- const agencySlice = createSlice({
16
- name: "agency",
17
- initialState,
18
- reducers: {
19
- setAgencyProfile: (state, action: PayloadAction<AgencyGraphQL>) => {
20
- state.agencyProfile = action.payload;
21
- },
22
- setLoadingAgencyProfile: (state, action: PayloadAction<boolean>) => {
23
- state.loadingAgencyProfile = action.payload;
24
- state.loadingAgencyProfile = false;
25
- },
26
- },
27
- });
28
-
29
- export const { setAgencyProfile, setLoadingAgencyProfile } =
30
- agencySlice.actions;
31
-
32
- export default agencySlice.reducer;
@@ -1,41 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
-
4
- export type AUTOMATIC_NUMBER_NAMES =
5
- | "dischargeIdNumber"
6
- | "purchaseOrderIdNumber";
7
-
8
- export interface AutomaticNumberState {
9
- purchaseOrderIdNumber: { loading: boolean; data: number | string };
10
- dischargeIdNumber: { loading: boolean; data: number | string };
11
- }
12
-
13
- const initialState: AutomaticNumberState = {
14
- purchaseOrderIdNumber: { data: "", loading: false },
15
- dischargeIdNumber: { data: "NCB00000", loading: false },
16
- };
17
-
18
- const automaticNumbersSlice = createSlice({
19
- name: "automaticNumbers",
20
- initialState,
21
- reducers: {
22
- automaticNumberFetchStart: (
23
- state,
24
- action: PayloadAction<AUTOMATIC_NUMBER_NAMES>
25
- ) => {
26
- state[action.payload].loading = true;
27
- },
28
- automaticNumberFetchSuccess: (
29
- state,
30
- action: PayloadAction<{ name: AUTOMATIC_NUMBER_NAMES; data: any }>
31
- ) => {
32
- state[action.payload.name].data = action.payload.data;
33
- state[action.payload.name].loading = false;
34
- },
35
- },
36
- });
37
-
38
- export const { automaticNumberFetchStart, automaticNumberFetchSuccess } =
39
- automaticNumbersSlice.actions;
40
-
41
- export default automaticNumbersSlice.reducer;
@@ -1,178 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
- import type {
4
- AgencyGraphQL,
5
- BitacoraPOMassive,
6
- BundleGraphQL,
7
- CaseGraphQL,
8
- CurrencyGraphQL,
9
- EmployeeGraphQL,
10
- FormGraphQL,
11
- FormSubmissionGraphQL,
12
- InvoiceGraphQL,
13
- ItemCategoryGraphQL,
14
- ItemGraphQL,
15
- LotStockGraphQL,
16
- MotivoRechazo,
17
- PayeeCategoryGraphQL,
18
- PayeeGraphQL,
19
- PaymentTermGraphQL,
20
- ReceptionType,
21
- ShipmentGraphQL,
22
- SuggestedPriceGraphQL,
23
- Template,
24
- TipoMuestra,
25
- WebAppRowGraphQL,
26
- } from "@zauru-sdk/types";
27
-
28
- export type ONLINE_CATALOGS_NAMES =
29
- | "invoiceFormSubmissionsByInvoiceId"
30
- | "invoiceFormSubmissionsByAgencyId";
31
-
32
- export type CATALOGS_NAMES =
33
- | "agencies"
34
- | "suggestedPrices"
35
- | "providers"
36
- | "providerCategories"
37
- | "receptionTypes"
38
- | "tiposDeMuestra"
39
- | "motivosRechazo"
40
- | "bitacoraRechazoMasivo"
41
- | "items"
42
- | "itemsByReception"
43
- | "itemsByLab"
44
- | "itemServicesByLab"
45
- | "itemCategoriesForLab"
46
- | "payees"
47
- | "payeesForLab"
48
- | "payeeCategoriesLabPrices"
49
- | "clientCategories"
50
- | "bundlesRecipForLab"
51
- | "currencies"
52
- | "paymentTerms"
53
- | "employeesByLab"
54
- | "employeesByCurrentAgency"
55
- | "invoicesByLab"
56
- | "invoiceForms"
57
- | "caseForms"
58
- | "invoiceFormSubmissions"
59
- | "myCases"
60
- | "myCaseFormSubmissions"
61
- | "shipmentsToMyAgency"
62
- | "myAgencyLotStocks"
63
- | "shipments"
64
- | "bookings"
65
- | "templates"
66
- | "bundlesForLab";
67
-
68
- type LoadingState<T> = {
69
- data: T;
70
- loading: boolean;
71
- reFetch: boolean;
72
- };
73
-
74
- type CatalogState = {
75
- agencies: LoadingState<AgencyGraphQL[]>;
76
- suggestedPrices: LoadingState<SuggestedPriceGraphQL[]>;
77
- providers: LoadingState<PayeeGraphQL[]>;
78
- providerCategories: LoadingState<PayeeCategoryGraphQL[]>;
79
- payees: LoadingState<PayeeGraphQL[]>;
80
- payeesForLab: LoadingState<PayeeGraphQL[]>;
81
- payeeCategoriesLabPrices: LoadingState<PayeeCategoryGraphQL[]>;
82
- clientCategories: LoadingState<PayeeCategoryGraphQL[]>;
83
- receptionTypes: LoadingState<WebAppRowGraphQL<ReceptionType>[]>;
84
- tiposDeMuestra: LoadingState<WebAppRowGraphQL<TipoMuestra>[]>;
85
- templates: LoadingState<WebAppRowGraphQL<Template>[]>;
86
- shipments: LoadingState<ShipmentGraphQL[]>;
87
- bookings: LoadingState<ShipmentGraphQL[]>;
88
- motivosRechazo: LoadingState<WebAppRowGraphQL<MotivoRechazo>[]>;
89
- bitacoraRechazoMasivo: LoadingState<WebAppRowGraphQL<BitacoraPOMassive>[]>;
90
- items: LoadingState<ItemGraphQL[]>;
91
- itemsByReception: LoadingState<ItemGraphQL[]>;
92
- itemsByLab: LoadingState<ItemGraphQL[]>;
93
- itemServicesByLab: LoadingState<ItemGraphQL[]>;
94
- itemCategoriesForLab: LoadingState<ItemCategoryGraphQL[]>;
95
- bundlesRecipForLab: LoadingState<BundleGraphQL[]>;
96
- bundlesForLab: LoadingState<BundleGraphQL[]>;
97
- currencies: LoadingState<CurrencyGraphQL[]>;
98
- paymentTerms: LoadingState<PaymentTermGraphQL[]>;
99
- employeesByLab: LoadingState<EmployeeGraphQL[]>;
100
- employeesByCurrentAgency: LoadingState<EmployeeGraphQL[]>;
101
- invoicesByLab: LoadingState<InvoiceGraphQL[]>;
102
- invoiceForms: LoadingState<FormGraphQL[]>;
103
- caseForms: LoadingState<FormGraphQL[]>;
104
- invoiceFormSubmissions: LoadingState<FormSubmissionGraphQL[]>;
105
- myCases: LoadingState<CaseGraphQL[]>;
106
- myCaseFormSubmissions: LoadingState<FormSubmissionGraphQL[]>;
107
- myAgencyLotStocks: LoadingState<LotStockGraphQL[]>;
108
- shipmentsToMyAgency: LoadingState<ShipmentGraphQL[]>;
109
- };
110
-
111
- const createLoadingState = <T>(initialData: T): LoadingState<T> => ({
112
- data: initialData,
113
- loading: false,
114
- reFetch: false,
115
- });
116
-
117
- const initialState: CatalogState = {
118
- agencies: createLoadingState([]),
119
- suggestedPrices: createLoadingState([]),
120
- providers: createLoadingState([]),
121
- providerCategories: createLoadingState([]),
122
- receptionTypes: createLoadingState([]),
123
- tiposDeMuestra: createLoadingState([]),
124
- templates: createLoadingState([]),
125
- shipments: createLoadingState([]),
126
- bookings: createLoadingState([]),
127
- motivosRechazo: createLoadingState([]),
128
- bitacoraRechazoMasivo: createLoadingState([]),
129
- items: createLoadingState([]),
130
- itemsByReception: createLoadingState([]),
131
- payees: createLoadingState([]),
132
- payeesForLab: createLoadingState([]),
133
- itemCategoriesForLab: createLoadingState([]),
134
- payeeCategoriesLabPrices: createLoadingState([]),
135
- clientCategories: createLoadingState([]),
136
- itemsByLab: createLoadingState([]),
137
- itemServicesByLab: createLoadingState([]),
138
- bundlesRecipForLab: createLoadingState([]),
139
- bundlesForLab: createLoadingState([]),
140
- currencies: createLoadingState([]),
141
- paymentTerms: createLoadingState([]),
142
- employeesByLab: createLoadingState([]),
143
- employeesByCurrentAgency: createLoadingState([]),
144
- invoicesByLab: createLoadingState([]),
145
- invoiceForms: createLoadingState([]),
146
- caseForms: createLoadingState([]),
147
- invoiceFormSubmissions: createLoadingState([]),
148
- myCases: createLoadingState([]),
149
- myCaseFormSubmissions: createLoadingState([]),
150
- myAgencyLotStocks: createLoadingState([]),
151
- shipmentsToMyAgency: createLoadingState([]),
152
- };
153
-
154
- const catalogsSlice = createSlice({
155
- name: "catalogs",
156
- initialState,
157
- reducers: {
158
- catalogsSetReFetch: (state, action: PayloadAction<CATALOGS_NAMES>) => {
159
- state[action.payload].reFetch = true;
160
- },
161
- catalogsFetchStart: (state, action: PayloadAction<CATALOGS_NAMES>) => {
162
- state[action.payload].loading = true;
163
- },
164
- catalogsFetchSuccess: (
165
- state,
166
- action: PayloadAction<{ name: CATALOGS_NAMES; data: any[] }>
167
- ) => {
168
- state[action.payload.name].data = action.payload.data;
169
- state[action.payload.name].loading = false;
170
- state[action.payload.name].reFetch = false;
171
- },
172
- },
173
- });
174
-
175
- export const { catalogsFetchStart, catalogsFetchSuccess, catalogsSetReFetch } =
176
- catalogsSlice.actions;
177
-
178
- export default catalogsSlice.reducer;
@@ -1,32 +0,0 @@
1
- import { createSlice, type PayloadAction } from "@reduxjs/toolkit";
2
-
3
- export type FormValidations = {
4
- formValidations: {
5
- [key: string]: {
6
- //formName
7
- [key: string]: string; //fieldName
8
- };
9
- };
10
- };
11
-
12
- const initialState: FormValidations = {
13
- formValidations: {},
14
- };
15
-
16
- const formValidationsSlice = createSlice({
17
- name: "formValidations",
18
- initialState,
19
- reducers: {
20
- setFieldError: (
21
- state,
22
- action: PayloadAction<{ formName: string; name: string; error: string }>
23
- ) => {
24
- state.formValidations[action.payload.formName][action.payload.name] =
25
- action.payload.error;
26
- },
27
- },
28
- });
29
-
30
- export const { setFieldError } = formValidationsSlice.actions;
31
-
32
- export default formValidationsSlice.reducer;
@@ -1,11 +0,0 @@
1
- export * from "./agency.slice.js";
2
- export * from "./automaticNumbers.slice.js";
3
- export * from "./catalogs.slice.js";
4
- export * from "./formValidation.slice.js";
5
- export * from "./profile.slice.js";
6
- export * from "./reception.slice.js";
7
- export * from "./session.slice.js";
8
- export * from "./tables.slice.js";
9
- export * from "./templates.slice.js";
10
- export * from "./user.slice.js";
11
- export * from "./webapp-tables.slice.js";
@@ -1,49 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
- import type {
4
- AgencyGraphQL,
5
- EmployeeGraphQL,
6
- OauthProfile,
7
- ProfileResponse,
8
- } from "@zauru-sdk/types";
9
-
10
- export type PROFILE_NAMES =
11
- | "userProfile"
12
- | "oauthProfile"
13
- | "employeeProfile"
14
- | "agencyProfile";
15
-
16
- export interface ProfilesState {
17
- userProfile: { loading: boolean; data: ProfileResponse };
18
- oauthProfile: { loading: boolean; data: OauthProfile };
19
- employeeProfile: { loading: boolean; data: EmployeeGraphQL };
20
- agencyProfile: { loading: boolean; data: AgencyGraphQL };
21
- }
22
-
23
- const initialState: ProfilesState = {
24
- userProfile: { data: {} as ProfileResponse, loading: false },
25
- oauthProfile: { data: {} as OauthProfile, loading: false },
26
- employeeProfile: { data: {} as EmployeeGraphQL, loading: false },
27
- agencyProfile: { data: {} as AgencyGraphQL, loading: false },
28
- };
29
-
30
- const profileSlice = createSlice({
31
- name: "profile",
32
- initialState,
33
- reducers: {
34
- profileFetchStart: (state, action: PayloadAction<PROFILE_NAMES>) => {
35
- state[action.payload].loading = true;
36
- },
37
- profileFetchSuccess: (
38
- state,
39
- action: PayloadAction<{ name: PROFILE_NAMES; data: any }>
40
- ) => {
41
- state[action.payload.name].data = action.payload.data;
42
- state[action.payload.name].loading = false;
43
- },
44
- },
45
- });
46
-
47
- export const { profileFetchStart, profileFetchSuccess } = profileSlice.actions;
48
-
49
- export default profileSlice.reducer;
@@ -1,118 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
- import {
4
- ItemAssociatedLots,
5
- NewPurchaseOrderResponse,
6
- PurchaseOrderGeneralInfo,
7
- PurchaseOrderGraphQL,
8
- RejectionWebAppTableObject,
9
- WebAppRowGraphQL,
10
- QueueFormReceptionWebAppTable,
11
- } from "@zauru-sdk/types";
12
-
13
- export type RECEPTION_NAMES =
14
- | "basketLots"
15
- | "rejectionInfo"
16
- | "newPurchaseOrderInfo"
17
- | "purchaseOrderGeneralInfo"
18
- | "poReceptions"
19
- | "queueNewReceptions";
20
-
21
- export interface ReceptionState {
22
- basketLots: { loading: boolean; data: ItemAssociatedLots; reFetch: boolean };
23
- rejectionInfo: {
24
- loading: boolean;
25
- data: RejectionWebAppTableObject;
26
- reFetch: boolean;
27
- };
28
- newPurchaseOrderInfo: {
29
- loading: boolean;
30
- data: NewPurchaseOrderResponse;
31
- reFetch: boolean;
32
- };
33
- purchaseOrderGeneralInfo: {
34
- loading: boolean;
35
- data: PurchaseOrderGeneralInfo;
36
- reFetch: boolean;
37
- };
38
- poReceptions: {
39
- loading: boolean;
40
- data: PurchaseOrderGraphQL[];
41
- reFetch: boolean;
42
- };
43
- queueNewReceptions: {
44
- loading: boolean;
45
- data: WebAppRowGraphQL<QueueFormReceptionWebAppTable>[];
46
- reFetch: boolean;
47
- };
48
- }
49
-
50
- const initialState: ReceptionState = {
51
- basketLots: {
52
- data: {} as ItemAssociatedLots,
53
- loading: false,
54
- reFetch: false,
55
- },
56
- rejectionInfo: {
57
- data: {} as RejectionWebAppTableObject,
58
- loading: false,
59
- reFetch: false,
60
- },
61
- newPurchaseOrderInfo: {
62
- data: {} as NewPurchaseOrderResponse,
63
- loading: false,
64
- reFetch: false,
65
- },
66
- purchaseOrderGeneralInfo: {
67
- data: {} as PurchaseOrderGeneralInfo,
68
- loading: false,
69
- reFetch: false,
70
- },
71
- poReceptions: {
72
- data: [],
73
- loading: false,
74
- reFetch: false,
75
- },
76
- queueNewReceptions: {
77
- data: [],
78
- loading: false,
79
- reFetch: false,
80
- },
81
- };
82
-
83
- const receptionSlice = createSlice({
84
- name: "reception",
85
- initialState,
86
- reducers: {
87
- receptionFetchStart: (state, action: PayloadAction<RECEPTION_NAMES>) => {
88
- state[action.payload].loading = true;
89
- },
90
- receptionFetchSuccess: (
91
- state,
92
- action: PayloadAction<{ name: RECEPTION_NAMES; data: any }>
93
- ) => {
94
- state[action.payload.name].data = action.payload.data;
95
- state[action.payload.name].loading = false;
96
- },
97
- receptionConcatToArray: (
98
- state,
99
- action: PayloadAction<{ name: RECEPTION_NAMES; data: any }>
100
- ) => {
101
- if (Array.isArray(state[action.payload.name].data)) {
102
- state[action.payload.name].data = [
103
- ...(state[action.payload.name].data as any),
104
- action.payload.data,
105
- ];
106
- }
107
- state[action.payload.name].loading = false;
108
- },
109
- },
110
- });
111
-
112
- export const {
113
- receptionFetchStart,
114
- receptionFetchSuccess,
115
- receptionConcatToArray,
116
- } = receptionSlice.actions;
117
-
118
- export default receptionSlice.reducer;
@@ -1,25 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
-
4
- export interface SessionState {
5
- [key: string]: any;
6
- }
7
-
8
- const initialState: SessionState = {};
9
-
10
- const sessionSlice = createSlice({
11
- name: "session",
12
- initialState,
13
- reducers: {
14
- setSessionValue: (
15
- state,
16
- action: PayloadAction<{ name: string; data: any }>
17
- ) => {
18
- state[action.payload.name] = action.payload.data;
19
- },
20
- },
21
- });
22
-
23
- export const { setSessionValue } = sessionSlice.actions;
24
-
25
- export default sessionSlice.reducer;
@@ -1,33 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
-
4
- export type TABLE_NAMES = "pageTable1" | "pageTable2" | "pageTable3";
5
-
6
- export interface TableState {
7
- pageTable1: number;
8
- pageTable2: number;
9
- pageTable3: number;
10
- }
11
-
12
- const initialState: TableState = {
13
- pageTable1: 1,
14
- pageTable2: 1,
15
- pageTable3: 1,
16
- };
17
-
18
- const tableSlice = createSlice({
19
- name: "table",
20
- initialState,
21
- reducers: {
22
- tableSetPage: (
23
- state,
24
- action: PayloadAction<{ name: TABLE_NAMES; data: number }>
25
- ) => {
26
- state[action.payload.name] = action.payload.data;
27
- },
28
- },
29
- });
30
-
31
- export const { tableSetPage } = tableSlice.actions;
32
-
33
- export default tableSlice.reducer;
@@ -1,34 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
-
4
- export type TEMPLATE_NAMES = "receptionTemplate";
5
-
6
- export interface TemplateState {
7
- receptionTemplate: { loading: boolean; data: string };
8
- }
9
-
10
- const initialState: TemplateState = {
11
- receptionTemplate: { data: "", loading: false },
12
- };
13
-
14
- const templateSlice = createSlice({
15
- name: "template",
16
- initialState,
17
- reducers: {
18
- templateFetchStart: (state, action: PayloadAction<TEMPLATE_NAMES>) => {
19
- state[action.payload].loading = true;
20
- },
21
- templateFetchSuccess: (
22
- state,
23
- action: PayloadAction<{ name: TEMPLATE_NAMES; data: any }>
24
- ) => {
25
- state[action.payload.name].data = action.payload.data;
26
- state[action.payload.name].loading = false;
27
- },
28
- },
29
- });
30
-
31
- export const { templateFetchStart, templateFetchSuccess } =
32
- templateSlice.actions;
33
-
34
- export default templateSlice.reducer;
@@ -1,64 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
- import {
4
- EmployeeGraphQL,
5
- OauthProfile,
6
- ProfileResponse,
7
- } from "@zauru-sdk/types";
8
-
9
- export interface UserState {
10
- userProfile: ProfileResponse;
11
- loadingUserProfile: boolean;
12
- oauthProfile: OauthProfile;
13
- loadingOauthProfile: boolean;
14
- employeeProfile: EmployeeGraphQL;
15
- loadingEmployeeInfo: boolean;
16
- }
17
-
18
- const initialState: UserState = {
19
- userProfile: {} as ProfileResponse,
20
- loadingUserProfile: false,
21
- oauthProfile: {} as OauthProfile,
22
- loadingOauthProfile: false,
23
- employeeProfile: {} as EmployeeGraphQL,
24
- loadingEmployeeInfo: false,
25
- };
26
-
27
- const userSlice = createSlice({
28
- name: "user",
29
- initialState,
30
- reducers: {
31
- setUserProfile: (state, action: PayloadAction<ProfileResponse>) => {
32
- state.userProfile = action.payload;
33
- state.loadingUserProfile = false;
34
- },
35
- setLoadingUserProfile: (state, action: PayloadAction<boolean>) => {
36
- state.loadingUserProfile = action.payload;
37
- },
38
- setOauthProfile: (state, action: PayloadAction<OauthProfile>) => {
39
- state.oauthProfile = action.payload;
40
- state.loadingOauthProfile = false;
41
- },
42
- setLoadingOauthProfile: (state, action: PayloadAction<boolean>) => {
43
- state.loadingOauthProfile = action.payload;
44
- },
45
- setEmployeeProfile: (state, action: PayloadAction<EmployeeGraphQL>) => {
46
- state.employeeProfile = action.payload;
47
- state.loadingEmployeeInfo = false;
48
- },
49
- setLoadingEmployeeProfile: (state, action: PayloadAction<boolean>) => {
50
- state.loadingEmployeeInfo = action.payload;
51
- },
52
- },
53
- });
54
-
55
- export const {
56
- setUserProfile,
57
- setEmployeeProfile,
58
- setOauthProfile,
59
- setLoadingEmployeeProfile,
60
- setLoadingOauthProfile,
61
- setLoadingUserProfile,
62
- } = userSlice.actions;
63
-
64
- export default userSlice.reducer;
@@ -1,35 +0,0 @@
1
- import type { PayloadAction } from "@reduxjs/toolkit";
2
- import { createSlice } from "@reduxjs/toolkit";
3
- import { SpecialItem, WebAppRowGraphQL } from "@zauru-sdk/types";
4
-
5
- export interface WebAppTableState {
6
- specialItems: WebAppRowGraphQL<SpecialItem>[];
7
- loadingSpecialItems: boolean;
8
- }
9
-
10
- const initialState: WebAppTableState = {
11
- specialItems: [],
12
- loadingSpecialItems: false,
13
- };
14
-
15
- const webappTablesSlice = createSlice({
16
- name: "webappTables",
17
- initialState,
18
- reducers: {
19
- setLoadingSpecialItems: (state, action: PayloadAction<boolean>) => {
20
- state.loadingSpecialItems = action.payload;
21
- },
22
- setSpecialItems: (
23
- state,
24
- action: PayloadAction<WebAppRowGraphQL<SpecialItem>[]>
25
- ) => {
26
- state.specialItems = action.payload;
27
- state.loadingSpecialItems = false;
28
- },
29
- },
30
- });
31
-
32
- export const { setLoadingSpecialItems, setSpecialItems } =
33
- webappTablesSlice.actions;
34
-
35
- export default webappTablesSlice.reducer;