washday-sdk 1.1.10 → 1.2.0
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.
- package/dist/api/attendance/get.js +4 -5
- package/dist/api/attendance/post.js +2 -3
- package/dist/api/attendance/put.js +1 -2
- package/dist/api/auth/post.js +13 -14
- package/dist/api/axiosInstance.js +47 -36
- package/dist/api/cashierbox/delete.js +2 -3
- package/dist/api/cashups/delete.js +1 -2
- package/dist/api/cashups/get.js +3 -4
- package/dist/api/cashups/post.js +1 -2
- package/dist/api/cashups/put.js +2 -2
- package/dist/api/cfdi/delete.js +1 -2
- package/dist/api/cfdi/get.js +6 -7
- package/dist/api/cfdi/post.js +2 -3
- package/dist/api/cfdi/put.js +2 -2
- package/dist/api/csv/get.js +13 -14
- package/dist/api/customers/delete.js +2 -3
- package/dist/api/customers/get.js +4 -4
- package/dist/api/customers/put.js +2 -3
- package/dist/api/discounts/get.js +7 -8
- package/dist/api/discounts/post.js +2 -3
- package/dist/api/discounts/put.js +4 -5
- package/dist/api/index.js +4 -1
- package/dist/api/inventory/get.js +1 -1
- package/dist/api/order/delete.js +2 -3
- package/dist/api/order/get.js +8 -9
- package/dist/api/order/post.js +7 -8
- package/dist/api/order/put.js +13 -14
- package/dist/api/outsourcedOrders/delete.js +1 -2
- package/dist/api/outsourcedOrders/get.js +3 -4
- package/dist/api/outsourcedOrders/post.js +1 -2
- package/dist/api/outsourcedOrders/put.js +1 -2
- package/dist/api/partners/delete.js +1 -2
- package/dist/api/partners/get.js +2 -3
- package/dist/api/partners/post.js +1 -2
- package/dist/api/partners/put.js +1 -2
- package/dist/api/pdf/get.js +1 -2
- package/dist/api/products/delete.js +2 -2
- package/dist/api/products/get.js +1 -2
- package/dist/api/products/put.js +1 -1
- package/dist/api/publics/get.js +1 -2
- package/dist/api/reports/get.js +15 -16
- package/dist/api/reviews/delete.js +1 -1
- package/dist/api/reviews/get.js +2 -3
- package/dist/api/reviews/post.js +1 -1
- package/dist/api/reviews/put.js +2 -2
- package/dist/api/routes/delete.js +1 -2
- package/dist/api/routes/get.js +5 -6
- package/dist/api/routes/post.js +3 -4
- package/dist/api/routes/put.js +3 -4
- package/dist/api/sections/delete.js +1 -2
- package/dist/api/sections/get.js +3 -4
- package/dist/api/sections/put.js +1 -2
- package/dist/api/staff/get.js +1 -1
- package/dist/api/stripe/post.js +1 -1
- package/dist/api/supplies/get.js +1 -1
- package/dist/api/users/post.js +1 -2
- package/package.json +1 -1
- package/src/api/attendance/get.ts +4 -4
- package/src/api/attendance/post.ts +2 -2
- package/src/api/attendance/put.ts +1 -1
- package/src/api/auth/post.ts +13 -13
- package/src/api/axiosInstance.ts +51 -40
- package/src/api/cashierbox/delete.ts +2 -2
- package/src/api/cashups/delete.ts +1 -1
- package/src/api/cashups/get.ts +3 -3
- package/src/api/cashups/post.ts +1 -1
- package/src/api/cashups/put.ts +2 -2
- package/src/api/cfdi/delete.ts +1 -1
- package/src/api/cfdi/get.ts +6 -6
- package/src/api/cfdi/post.ts +2 -2
- package/src/api/cfdi/put.ts +2 -2
- package/src/api/csv/get.ts +13 -13
- package/src/api/customers/delete.ts +2 -2
- package/src/api/customers/get.ts +4 -4
- package/src/api/customers/put.ts +2 -2
- package/src/api/discounts/get.ts +7 -7
- package/src/api/discounts/post.ts +2 -2
- package/src/api/discounts/put.ts +4 -4
- package/src/api/index.ts +4 -2
- package/src/api/inventory/get.ts +1 -1
- package/src/api/order/delete.ts +2 -2
- package/src/api/order/get.ts +8 -8
- package/src/api/order/post.ts +7 -7
- package/src/api/order/put.ts +13 -13
- package/src/api/outsourcedOrders/delete.ts +1 -1
- package/src/api/outsourcedOrders/get.ts +3 -3
- package/src/api/outsourcedOrders/post.ts +1 -1
- package/src/api/outsourcedOrders/put.ts +1 -1
- package/src/api/partners/delete.ts +1 -1
- package/src/api/partners/get.ts +2 -2
- package/src/api/partners/post.ts +1 -1
- package/src/api/partners/put.ts +1 -1
- package/src/api/pdf/get.ts +1 -1
- package/src/api/products/delete.ts +2 -2
- package/src/api/products/get.ts +1 -1
- package/src/api/products/put.ts +1 -1
- package/src/api/publics/get.ts +1 -1
- package/src/api/reports/get.ts +15 -15
- package/src/api/reviews/delete.ts +1 -1
- package/src/api/reviews/get.ts +2 -2
- package/src/api/reviews/post.ts +1 -1
- package/src/api/reviews/put.ts +2 -2
- package/src/api/routes/delete.ts +1 -1
- package/src/api/routes/get.ts +5 -5
- package/src/api/routes/post.ts +3 -3
- package/src/api/routes/put.ts +3 -3
- package/src/api/sections/delete.ts +1 -1
- package/src/api/sections/get.ts +3 -3
- package/src/api/sections/put.ts +1 -1
- package/src/api/staff/get.ts +1 -1
- package/src/api/stripe/post.ts +1 -1
- package/src/api/supplies/get.ts +1 -1
- package/src/api/users/post.ts +1 -1
- package/src/interfaces/Api.ts +3 -0
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const ATTENDANCE_API = 'api/attendance';
|
|
12
11
|
export const getHistory = function (params) {
|
|
13
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -31,7 +30,7 @@ export const getHistory = function (params) {
|
|
|
31
30
|
// Remove trailing '&'
|
|
32
31
|
queryParams = queryParams.slice(0, -1);
|
|
33
32
|
const url = queryParams ? `${ATTENDANCE_API}/history?${queryParams}` : `${ATTENDANCE_API}/history`;
|
|
34
|
-
return yield axiosInstance.get(url, config);
|
|
33
|
+
return yield this.axiosInstance.get(url, config);
|
|
35
34
|
}
|
|
36
35
|
catch (error) {
|
|
37
36
|
console.error('Error fetching attendance history:', error);
|
|
@@ -53,7 +52,7 @@ export const getStatus = function (params) {
|
|
|
53
52
|
// Remove trailing '&'
|
|
54
53
|
queryParams = queryParams.slice(0, -1);
|
|
55
54
|
const url = queryParams ? `${ATTENDANCE_API}/status?${queryParams}` : `${ATTENDANCE_API}/status`;
|
|
56
|
-
return yield axiosInstance.get(url, config);
|
|
55
|
+
return yield this.axiosInstance.get(url, config);
|
|
57
56
|
}
|
|
58
57
|
catch (error) {
|
|
59
58
|
console.error('Error fetching attendance status:', error);
|
|
@@ -81,7 +80,7 @@ export const getStoreReport = function (storeId, params) {
|
|
|
81
80
|
// Remove trailing '&'
|
|
82
81
|
queryParams = queryParams.slice(0, -1);
|
|
83
82
|
const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report`;
|
|
84
|
-
return yield axiosInstance.get(url, config);
|
|
83
|
+
return yield this.axiosInstance.get(url, config);
|
|
85
84
|
}
|
|
86
85
|
catch (error) {
|
|
87
86
|
console.error('Error fetching store attendance report:', error);
|
|
@@ -112,7 +111,7 @@ export const exportStoreReport = function (storeId, params) {
|
|
|
112
111
|
// Remove trailing '&'
|
|
113
112
|
queryParams = queryParams.slice(0, -1);
|
|
114
113
|
const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report/export`;
|
|
115
|
-
return yield axiosInstance.get(url, config);
|
|
114
|
+
return yield this.axiosInstance.get(url, config);
|
|
116
115
|
}
|
|
117
116
|
catch (error) {
|
|
118
117
|
console.error('Error exporting store attendance report:', error);
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const ATTENDANCE_API = 'api/attendance';
|
|
12
11
|
export const clockIn = function (data) {
|
|
13
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,7 +14,7 @@ export const clockIn = function (data) {
|
|
|
15
14
|
const config = {
|
|
16
15
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
16
|
};
|
|
18
|
-
return yield axiosInstance.post(`${ATTENDANCE_API}/clock-in`, data, config);
|
|
17
|
+
return yield this.axiosInstance.post(`${ATTENDANCE_API}/clock-in`, data, config);
|
|
19
18
|
}
|
|
20
19
|
catch (error) {
|
|
21
20
|
console.error('Error clock-in:', error);
|
|
@@ -29,7 +28,7 @@ export const clockOut = function (data) {
|
|
|
29
28
|
const config = {
|
|
30
29
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
31
30
|
};
|
|
32
|
-
return yield axiosInstance.post(`${ATTENDANCE_API}/clock-out`, data, config);
|
|
31
|
+
return yield this.axiosInstance.post(`${ATTENDANCE_API}/clock-out`, data, config);
|
|
33
32
|
}
|
|
34
33
|
catch (error) {
|
|
35
34
|
console.error('Error clock-out:', error);
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const ATTENDANCE_API = 'api/attendance';
|
|
12
11
|
export const updateById = function (id, data) {
|
|
13
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,7 +14,7 @@ export const updateById = function (id, data) {
|
|
|
15
14
|
const config = {
|
|
16
15
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
16
|
};
|
|
18
|
-
return yield axiosInstance.put(`${ATTENDANCE_API}/${id}`, data, config);
|
|
17
|
+
return yield this.axiosInstance.put(`${ATTENDANCE_API}/${id}`, data, config);
|
|
19
18
|
}
|
|
20
19
|
catch (error) {
|
|
21
20
|
console.error('Error updating attendance entry:', error);
|
package/dist/api/auth/post.js
CHANGED
|
@@ -7,14 +7,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const CUSTOMERSAPP_GET_AUTH = "api/v2/washdayapp/auth";
|
|
12
11
|
const REGULAR_USER_AUTH = "api/auth";
|
|
13
12
|
export const customerLoginToken = function (params) {
|
|
14
13
|
return __awaiter(this, void 0, void 0, function* () {
|
|
15
14
|
try {
|
|
16
15
|
const config = {};
|
|
17
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/tokenLogin`, params, config);
|
|
16
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/tokenLogin`, params, config);
|
|
18
17
|
}
|
|
19
18
|
catch (error) {
|
|
20
19
|
console.error('Error fetching customerLoginToken:', error);
|
|
@@ -26,7 +25,7 @@ export const appleLogin = function (params) {
|
|
|
26
25
|
return __awaiter(this, void 0, void 0, function* () {
|
|
27
26
|
try {
|
|
28
27
|
const config = {};
|
|
29
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/apple`, params, config);
|
|
28
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/apple`, params, config);
|
|
30
29
|
}
|
|
31
30
|
catch (error) {
|
|
32
31
|
console.error('Error fetching appleLogin:', error);
|
|
@@ -38,7 +37,7 @@ export const facebookLogin = function (params) {
|
|
|
38
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
39
38
|
try {
|
|
40
39
|
const config = {};
|
|
41
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/facebook`, params, config);
|
|
40
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/facebook`, params, config);
|
|
42
41
|
}
|
|
43
42
|
catch (error) {
|
|
44
43
|
console.error('Error fetching facebookLogin:', error);
|
|
@@ -50,7 +49,7 @@ export const customerRegularLogin = function (params) {
|
|
|
50
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
50
|
try {
|
|
52
51
|
const config = {};
|
|
53
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/login`, params, config);
|
|
52
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/login`, params, config);
|
|
54
53
|
}
|
|
55
54
|
catch (error) {
|
|
56
55
|
console.error('Error fetching customerRegularLogin:', error);
|
|
@@ -62,7 +61,7 @@ export const customerSignUp = function (params) {
|
|
|
62
61
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
62
|
try {
|
|
64
63
|
const config = {};
|
|
65
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/signUp`, params, config);
|
|
64
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/signUp`, params, config);
|
|
66
65
|
}
|
|
67
66
|
catch (error) {
|
|
68
67
|
console.error('Error fetching customerSignUp:', error);
|
|
@@ -74,7 +73,7 @@ export const googleLogin = function (params) {
|
|
|
74
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
75
74
|
try {
|
|
76
75
|
const config = {};
|
|
77
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/google`, params, config);
|
|
76
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/google`, params, config);
|
|
78
77
|
}
|
|
79
78
|
catch (error) {
|
|
80
79
|
console.error('Error fetching googleLogin:', error);
|
|
@@ -86,7 +85,7 @@ export const regularUserLogin = function (params) {
|
|
|
86
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
86
|
try {
|
|
88
87
|
const config = {};
|
|
89
|
-
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/login`, params, config);
|
|
88
|
+
return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/login`, params, config);
|
|
90
89
|
}
|
|
91
90
|
catch (error) {
|
|
92
91
|
console.error('Error fetching regularUserLogin:', error);
|
|
@@ -98,7 +97,7 @@ export const companySignUp = function (params) {
|
|
|
98
97
|
return __awaiter(this, void 0, void 0, function* () {
|
|
99
98
|
try {
|
|
100
99
|
const config = {};
|
|
101
|
-
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/register`, params, config);
|
|
100
|
+
return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/register`, params, config);
|
|
102
101
|
}
|
|
103
102
|
catch (error) {
|
|
104
103
|
console.error('Error fetching companySignUp:', error);
|
|
@@ -110,7 +109,7 @@ export const regularUserTokenLogin = function (params) {
|
|
|
110
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
111
110
|
try {
|
|
112
111
|
const config = {};
|
|
113
|
-
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/tokenLogin`, params, config);
|
|
112
|
+
return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/tokenLogin`, params, config);
|
|
114
113
|
}
|
|
115
114
|
catch (error) {
|
|
116
115
|
console.error('Error fetching regularUserTokenLogin:', error);
|
|
@@ -122,7 +121,7 @@ export const forgotPassword = function (params) {
|
|
|
122
121
|
return __awaiter(this, void 0, void 0, function* () {
|
|
123
122
|
try {
|
|
124
123
|
const config = {};
|
|
125
|
-
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/forget-password`, params, config);
|
|
124
|
+
return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/forget-password`, params, config);
|
|
126
125
|
}
|
|
127
126
|
catch (error) {
|
|
128
127
|
console.error('Error fetching forgotPassword:', error);
|
|
@@ -134,7 +133,7 @@ export const customersAppForgotPassword = function (companyId, params) {
|
|
|
134
133
|
return __awaiter(this, void 0, void 0, function* () {
|
|
135
134
|
try {
|
|
136
135
|
const config = {};
|
|
137
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/${companyId}/forget-password`, params, config);
|
|
136
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/${companyId}/forget-password`, params, config);
|
|
138
137
|
}
|
|
139
138
|
catch (error) {
|
|
140
139
|
console.error('Error fetching customersAppForgotPassword:', error);
|
|
@@ -146,7 +145,7 @@ export const customersAppChangePassword = function (params) {
|
|
|
146
145
|
return __awaiter(this, void 0, void 0, function* () {
|
|
147
146
|
try {
|
|
148
147
|
const config = {};
|
|
149
|
-
return yield axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/change-password`, params, config);
|
|
148
|
+
return yield this.axiosInstance.post(`${CUSTOMERSAPP_GET_AUTH}/change-password`, params, config);
|
|
150
149
|
}
|
|
151
150
|
catch (error) {
|
|
152
151
|
console.error('Error fetching customerSignUp:', error);
|
|
@@ -160,7 +159,7 @@ export const pinLogin = function (data) {
|
|
|
160
159
|
const config = {
|
|
161
160
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
162
161
|
};
|
|
163
|
-
return yield axiosInstance.post(`${REGULAR_USER_AUTH}/pin-login`, data, config);
|
|
162
|
+
return yield this.axiosInstance.post(`${REGULAR_USER_AUTH}/pin-login`, data, config);
|
|
164
163
|
}
|
|
165
164
|
catch (error) {
|
|
166
165
|
console.error('Error fetching pinLogin:', error);
|
|
@@ -2,45 +2,56 @@ import axios from 'axios';
|
|
|
2
2
|
import { v4 } from 'uuid';
|
|
3
3
|
// Define the type for the Axios instance
|
|
4
4
|
let axiosInstance = null;
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
const DEV_BASE_URL = 'http://localhost:5555/';
|
|
6
|
+
const STAGE_BASE_URL = 'https://washday-backend-development.herokuapp.com/';
|
|
7
|
+
const PROD_BASE_URL = 'https://washday-backend.herokuapp.com/';
|
|
7
8
|
const BASE_URL = 'https://washday-backend.herokuapp.com/';
|
|
8
9
|
// Function to create or return the singleton instance
|
|
9
|
-
const getAxiosInstance = () => {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
const { Authorization } = config.headers || {};
|
|
22
|
-
let contentType = config.headers['Content-Type'];
|
|
23
|
-
if (contentType === null || contentType === undefined) {
|
|
24
|
-
contentType = 'application/json';
|
|
25
|
-
}
|
|
26
|
-
if (Authorization || token) {
|
|
27
|
-
config.headers.Authorization = Authorization || `Bearer ${token}`;
|
|
28
|
-
}
|
|
29
|
-
if (contentType) {
|
|
30
|
-
config.headers['Content-Type'] = contentType;
|
|
31
|
-
}
|
|
32
|
-
if (responseType) {
|
|
33
|
-
config.responseType = responseType;
|
|
34
|
-
}
|
|
35
|
-
if (contentDisposition) {
|
|
36
|
-
config.headers['Content-Disposition'] = contentDisposition;
|
|
37
|
-
}
|
|
38
|
-
config.headers['x-request-id'] = v4(); // used to track requests in the backend
|
|
39
|
-
return config;
|
|
40
|
-
}, (error) => {
|
|
41
|
-
return Promise.reject(error);
|
|
42
|
-
});
|
|
10
|
+
export const getAxiosInstance = (env = 'PROD') => {
|
|
11
|
+
let baseURL = BASE_URL;
|
|
12
|
+
switch (env) {
|
|
13
|
+
case 'DEV':
|
|
14
|
+
baseURL = DEV_BASE_URL;
|
|
15
|
+
break;
|
|
16
|
+
case 'STAGE':
|
|
17
|
+
baseURL = STAGE_BASE_URL;
|
|
18
|
+
break;
|
|
19
|
+
case 'PROD':
|
|
20
|
+
baseURL = PROD_BASE_URL;
|
|
21
|
+
break;
|
|
43
22
|
}
|
|
23
|
+
axiosInstance = axios.create({
|
|
24
|
+
baseURL: baseURL,
|
|
25
|
+
headers: {
|
|
26
|
+
'Content-Type': 'application/json',
|
|
27
|
+
// Add any default headers here
|
|
28
|
+
},
|
|
29
|
+
});
|
|
30
|
+
// Add interceptor to set token and other options for every request
|
|
31
|
+
axiosInstance.interceptors.request.use((config) => {
|
|
32
|
+
const { token, responseType = 'json', contentDisposition } = config.params || {};
|
|
33
|
+
const { Authorization } = config.headers || {};
|
|
34
|
+
let contentType = config.headers['Content-Type'];
|
|
35
|
+
if (contentType === null || contentType === undefined) {
|
|
36
|
+
contentType = 'application/json';
|
|
37
|
+
}
|
|
38
|
+
if (Authorization || token) {
|
|
39
|
+
config.headers.Authorization = Authorization || `Bearer ${token}`;
|
|
40
|
+
}
|
|
41
|
+
if (contentType) {
|
|
42
|
+
config.headers['Content-Type'] = contentType;
|
|
43
|
+
}
|
|
44
|
+
if (responseType) {
|
|
45
|
+
config.responseType = responseType;
|
|
46
|
+
}
|
|
47
|
+
if (contentDisposition) {
|
|
48
|
+
config.headers['Content-Disposition'] = contentDisposition;
|
|
49
|
+
}
|
|
50
|
+
config.headers['x-request-id'] = v4(); // used to track requests in the backend
|
|
51
|
+
return config;
|
|
52
|
+
}, (error) => {
|
|
53
|
+
return Promise.reject(error);
|
|
54
|
+
});
|
|
44
55
|
return axiosInstance;
|
|
45
56
|
};
|
|
46
57
|
export default getAxiosInstance();
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_CASHIER_BOX = (storeId) => `api/store/${storeId}/cashierbox`;
|
|
12
11
|
const GET_SET_CASHIER_BOX_MOVEMENT = (storeId, cashierBoxId) => `/api/store/cashierbox/movement/${storeId}/${cashierBoxId}`;
|
|
13
12
|
export const deleteCashierBoxById = function (storeId, id) {
|
|
@@ -16,7 +15,7 @@ export const deleteCashierBoxById = function (storeId, id) {
|
|
|
16
15
|
const config = {
|
|
17
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
17
|
};
|
|
19
|
-
return yield axiosInstance.delete(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, config);
|
|
18
|
+
return yield this.axiosInstance.delete(`${GET_SET_CASHIER_BOX(storeId)}/${id}`, config);
|
|
20
19
|
}
|
|
21
20
|
catch (error) {
|
|
22
21
|
console.error('Error fetching getStoreStaff:', error);
|
|
@@ -30,7 +29,7 @@ export const deleteCashierBoxMovementById = function (_a) {
|
|
|
30
29
|
const config = {
|
|
31
30
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
31
|
};
|
|
33
|
-
return yield axiosInstance.delete(`${GET_SET_CASHIER_BOX_MOVEMENT(storeId, cashierBoxId)}/${movementId}`, config);
|
|
32
|
+
return yield this.axiosInstance.delete(`${GET_SET_CASHIER_BOX_MOVEMENT(storeId, cashierBoxId)}/${movementId}`, config);
|
|
34
33
|
}
|
|
35
34
|
catch (error) {
|
|
36
35
|
console.error('Error fetching getStoreStaff:', error);
|
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_CASH_UP_REPORTS = 'api/cashupreports';
|
|
12
11
|
export const deleteCashUpReport = function (storeId, id) {
|
|
13
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,7 +14,7 @@ export const deleteCashUpReport = function (storeId, id) {
|
|
|
15
14
|
const config = {
|
|
16
15
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
16
|
};
|
|
18
|
-
return yield axiosInstance.delete(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
|
|
17
|
+
return yield this.axiosInstance.delete(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
|
|
19
18
|
}
|
|
20
19
|
catch (error) {
|
|
21
20
|
console.error('Error fetching:', error);
|
package/dist/api/cashups/get.js
CHANGED
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
-
import axiosInstance from "../axiosInstance";
|
|
12
11
|
const GET_CASH_UP = 'api/cashup';
|
|
13
12
|
const GET_CASH_UP_REPORTS = 'api/cashupreports';
|
|
14
13
|
export const getList = function (storeId, params) {
|
|
@@ -22,7 +21,7 @@ export const getList = function (storeId, params) {
|
|
|
22
21
|
'limit',
|
|
23
22
|
'cashierBoxId'
|
|
24
23
|
], params);
|
|
25
|
-
return yield axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}?${queryParams}`, config);
|
|
24
|
+
return yield this.axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}?${queryParams}`, config);
|
|
26
25
|
}
|
|
27
26
|
catch (error) {
|
|
28
27
|
console.error('Error fetching getList orders:', error);
|
|
@@ -36,7 +35,7 @@ export const getById = function (storeId, id) {
|
|
|
36
35
|
const config = {
|
|
37
36
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
38
37
|
};
|
|
39
|
-
return yield axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
|
|
38
|
+
return yield this.axiosInstance.get(`${GET_CASH_UP_REPORTS}/${storeId}/${id}`, config);
|
|
40
39
|
}
|
|
41
40
|
catch (error) {
|
|
42
41
|
console.error('Error fetching:', error);
|
|
@@ -50,7 +49,7 @@ export const getPreviewDataForCashClose = function (storeId, id) {
|
|
|
50
49
|
const config = {
|
|
51
50
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
52
51
|
};
|
|
53
|
-
return yield axiosInstance.get(`${GET_CASH_UP}/${storeId}/${id}`, config);
|
|
52
|
+
return yield this.axiosInstance.get(`${GET_CASH_UP}/${storeId}/${id}`, config);
|
|
54
53
|
}
|
|
55
54
|
catch (error) {
|
|
56
55
|
console.error('Error fetching:', error);
|
package/dist/api/cashups/post.js
CHANGED
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_CASH_UP = 'api/cashup';
|
|
12
11
|
export const create = function (storeId, id, data) {
|
|
13
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,7 +14,7 @@ export const create = function (storeId, id, data) {
|
|
|
15
14
|
const config = {
|
|
16
15
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
16
|
};
|
|
18
|
-
return yield axiosInstance.post(`${GET_CASH_UP}/${storeId}/${id}`, data, config);
|
|
17
|
+
return yield this.axiosInstance.post(`${GET_CASH_UP}/${storeId}/${id}`, data, config);
|
|
19
18
|
}
|
|
20
19
|
catch (error) {
|
|
21
20
|
console.error('Error fetching create:', error);
|
package/dist/api/cashups/put.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// const config = {
|
|
31
31
|
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
32
|
// };
|
|
33
|
-
// return await axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
|
|
33
|
+
// return await this.axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
|
|
34
34
|
// } catch (error) {
|
|
35
35
|
// console.error('Error fetching updateById:', error);
|
|
36
36
|
// throw error;
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
// const config = {
|
|
45
45
|
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
46
46
|
// };
|
|
47
|
-
// return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
|
|
47
|
+
// return await this.axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
|
|
48
48
|
// } catch (error) {
|
|
49
49
|
// console.error('Error fetching updateById:', error);
|
|
50
50
|
// throw error;
|
package/dist/api/cfdi/delete.js
CHANGED
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_CFDI = 'api/cfdi';
|
|
12
11
|
export const cancelCFDI = function (id, data) {
|
|
13
12
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,7 +14,7 @@ export const cancelCFDI = function (id, data) {
|
|
|
15
14
|
const config = {
|
|
16
15
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
16
|
};
|
|
18
|
-
return yield axiosInstance.delete(`${GET_SET_CFDI}/${id}`, Object.assign(Object.assign({}, config), { data }));
|
|
17
|
+
return yield this.axiosInstance.delete(`${GET_SET_CFDI}/${id}`, Object.assign(Object.assign({}, config), { data }));
|
|
19
18
|
}
|
|
20
19
|
catch (error) {
|
|
21
20
|
console.error('Error fetching deleteById:', error);
|
package/dist/api/cfdi/get.js
CHANGED
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { generateQueryParamsStr } from "../../utils/apiUtils";
|
|
11
|
-
import axiosInstance from "../axiosInstance";
|
|
12
11
|
const GET_ORDERS_CFDI_PREVIEW = (orderID) => `api/order/${orderID}/preview/cfdi`;
|
|
13
12
|
const GET_SET_CFDI = 'api/cfdi';
|
|
14
13
|
export const getList = function (params) {
|
|
@@ -25,7 +24,7 @@ export const getList = function (params) {
|
|
|
25
24
|
'limit',
|
|
26
25
|
'pageNum'
|
|
27
26
|
], params);
|
|
28
|
-
return yield axiosInstance.get(`${GET_SET_CFDI}?${queryParams}`, config);
|
|
27
|
+
return yield this.axiosInstance.get(`${GET_SET_CFDI}?${queryParams}`, config);
|
|
29
28
|
}
|
|
30
29
|
catch (error) {
|
|
31
30
|
console.error('Error fetching getList CFDI:', error);
|
|
@@ -41,7 +40,7 @@ export const getCFDIPreviewByOrderId = function (id) {
|
|
|
41
40
|
const config = {
|
|
42
41
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
43
42
|
};
|
|
44
|
-
return yield axiosInstance.get(`${GET_ORDERS_CFDI_PREVIEW(id)}`, config);
|
|
43
|
+
return yield this.axiosInstance.get(`${GET_ORDERS_CFDI_PREVIEW(id)}`, config);
|
|
45
44
|
}
|
|
46
45
|
catch (error) {
|
|
47
46
|
console.error('Error fetching:', error);
|
|
@@ -62,7 +61,7 @@ export const downloadCFDIPDF = function (id) {
|
|
|
62
61
|
responseType: 'arraybuffer'
|
|
63
62
|
}
|
|
64
63
|
};
|
|
65
|
-
return yield axiosInstance.get(`${GET_SET_CFDI}/${id}/download/pdf`, config);
|
|
64
|
+
return yield this.axiosInstance.get(`${GET_SET_CFDI}/${id}/download/pdf`, config);
|
|
66
65
|
}
|
|
67
66
|
catch (error) {
|
|
68
67
|
console.error('Error fetching downloadCFDIPDF:', error);
|
|
@@ -83,7 +82,7 @@ export const downloadCFDIZIP = function (id) {
|
|
|
83
82
|
responseType: 'arraybuffer'
|
|
84
83
|
}
|
|
85
84
|
};
|
|
86
|
-
return yield axiosInstance.get(`${GET_SET_CFDI}/${id}/download/zip`, config);
|
|
85
|
+
return yield this.axiosInstance.get(`${GET_SET_CFDI}/${id}/download/zip`, config);
|
|
87
86
|
}
|
|
88
87
|
catch (error) {
|
|
89
88
|
console.error('Error fetching downloadCFDIZIP:', error);
|
|
@@ -97,7 +96,7 @@ export const sendCFDIByEmail = function (id) {
|
|
|
97
96
|
const config = {
|
|
98
97
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
99
98
|
};
|
|
100
|
-
return yield axiosInstance.get(`${GET_SET_CFDI}/${id}/email`, config);
|
|
99
|
+
return yield this.axiosInstance.get(`${GET_SET_CFDI}/${id}/email`, config);
|
|
101
100
|
}
|
|
102
101
|
catch (error) {
|
|
103
102
|
console.error('Error fetching:', error);
|
|
@@ -116,7 +115,7 @@ export const getCFDIPreview = function (params) {
|
|
|
116
115
|
'ordersID',
|
|
117
116
|
'customer',
|
|
118
117
|
], params);
|
|
119
|
-
return yield axiosInstance.get(`${GET_SET_CFDI}/preview?${queryParams}`, config);
|
|
118
|
+
return yield this.axiosInstance.get(`${GET_SET_CFDI}/preview?${queryParams}`, config);
|
|
120
119
|
}
|
|
121
120
|
catch (error) {
|
|
122
121
|
console.error('Error fetching:', error);
|
package/dist/api/cfdi/post.js
CHANGED
|
@@ -7,7 +7,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
-
import axiosInstance from "../axiosInstance";
|
|
11
10
|
const GET_SET_CFDI = 'api/cfdi';
|
|
12
11
|
const GET_SET_ORDERS_CFDI = (orderID) => `api/order/${orderID}/cfdi`;
|
|
13
12
|
export const createCFDI = function (data) {
|
|
@@ -16,7 +15,7 @@ export const createCFDI = function (data) {
|
|
|
16
15
|
const config = {
|
|
17
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
18
17
|
};
|
|
19
|
-
return yield axiosInstance.post(GET_SET_CFDI, data, config);
|
|
18
|
+
return yield this.axiosInstance.post(GET_SET_CFDI, data, config);
|
|
20
19
|
}
|
|
21
20
|
catch (error) {
|
|
22
21
|
console.error('Error createCFDI:', error);
|
|
@@ -31,7 +30,7 @@ export const createGlobalCFDI = function (data) {
|
|
|
31
30
|
const config = {
|
|
32
31
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
33
32
|
};
|
|
34
|
-
return yield axiosInstance.post(`${GET_SET_CFDI}/global`, Object.assign(Object.assign({}, data), { ordersID: (_a = data.ordersID) === null || _a === void 0 ? void 0 : _a.join(',') }), config);
|
|
33
|
+
return yield this.axiosInstance.post(`${GET_SET_CFDI}/global`, Object.assign(Object.assign({}, data), { ordersID: (_a = data.ordersID) === null || _a === void 0 ? void 0 : _a.join(',') }), config);
|
|
35
34
|
}
|
|
36
35
|
catch (error) {
|
|
37
36
|
console.error('Error fetching create:', error);
|
package/dist/api/cfdi/put.js
CHANGED
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
// const config = {
|
|
31
31
|
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
32
32
|
// };
|
|
33
|
-
// return await axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
|
|
33
|
+
// return await this.axiosInstance.put(`${GET_SET_ORDER}/${id}`, data, config);
|
|
34
34
|
// } catch (error) {
|
|
35
35
|
// console.error('Error fetching updateById:', error);
|
|
36
36
|
// throw error;
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
// const config = {
|
|
45
45
|
// headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
46
46
|
// };
|
|
47
|
-
// return await axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
|
|
47
|
+
// return await this.axiosInstance.put(`${GET_SET_ORDER_PAYMENTLINES(orderId)}/${id}`, data, config);
|
|
48
48
|
// } catch (error) {
|
|
49
49
|
// console.error('Error fetching updateById:', error);
|
|
50
50
|
// throw error;
|