washday-sdk 1.1.2 → 1.1.3
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 +5 -2
- package/package.json +1 -1
- package/src/api/attendance/get.ts +18 -15
|
@@ -95,9 +95,12 @@ export const exportStoreReport = function (storeId, params) {
|
|
|
95
95
|
const config = {
|
|
96
96
|
headers: {
|
|
97
97
|
Authorization: `Bearer ${this.apiToken}`,
|
|
98
|
-
'Content-Type': '
|
|
98
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
99
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
99
100
|
},
|
|
100
|
-
|
|
101
|
+
params: {
|
|
102
|
+
responseType: 'blob'
|
|
103
|
+
}
|
|
101
104
|
};
|
|
102
105
|
let queryParams = '';
|
|
103
106
|
if (params === null || params === void 0 ? void 0 : params.startDate)
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ export const getHistory = async function (this: WashdayClientInstance, params: {
|
|
|
15
15
|
const config = {
|
|
16
16
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
17
17
|
};
|
|
18
|
-
|
|
18
|
+
|
|
19
19
|
let queryParams = '';
|
|
20
20
|
if (params.userId) queryParams += `userId=${params.userId}&`; // ✅ AÑADIDO
|
|
21
21
|
if (params.storeId) queryParams += `storeId=${params.storeId}&`;
|
|
@@ -23,10 +23,10 @@ export const getHistory = async function (this: WashdayClientInstance, params: {
|
|
|
23
23
|
if (params.endDate) queryParams += `endDate=${params.endDate}&`;
|
|
24
24
|
if (params.pageNum) queryParams += `pageNum=${params.pageNum}&`;
|
|
25
25
|
if (params.limit) queryParams += `limit=${params.limit}&`;
|
|
26
|
-
|
|
26
|
+
|
|
27
27
|
// Remove trailing '&'
|
|
28
28
|
queryParams = queryParams.slice(0, -1);
|
|
29
|
-
|
|
29
|
+
|
|
30
30
|
const url = queryParams ? `${ATTENDANCE_API}/history?${queryParams}` : `${ATTENDANCE_API}/history`;
|
|
31
31
|
return await axiosInstance.get(url, config);
|
|
32
32
|
} catch (error) {
|
|
@@ -43,14 +43,14 @@ export const getStatus = async function (this: WashdayClientInstance, params?: {
|
|
|
43
43
|
const config = {
|
|
44
44
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
45
45
|
};
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
let queryParams = '';
|
|
48
48
|
if (params?.storeId) queryParams += `storeId=${params.storeId}&`;
|
|
49
49
|
if (params?.userId) queryParams += `userId=${params.userId}&`; // ✅ ARREGLADO - añadir &
|
|
50
|
-
|
|
50
|
+
|
|
51
51
|
// Remove trailing '&'
|
|
52
52
|
queryParams = queryParams.slice(0, -1);
|
|
53
|
-
|
|
53
|
+
|
|
54
54
|
const url = queryParams ? `${ATTENDANCE_API}/status?${queryParams}` : `${ATTENDANCE_API}/status`;
|
|
55
55
|
return await axiosInstance.get(url, config);
|
|
56
56
|
} catch (error) {
|
|
@@ -70,17 +70,17 @@ export const getStoreReport = async function (this: WashdayClientInstance, store
|
|
|
70
70
|
const config = {
|
|
71
71
|
headers: { Authorization: `Bearer ${this.apiToken}` }
|
|
72
72
|
};
|
|
73
|
-
|
|
73
|
+
|
|
74
74
|
let queryParams = '';
|
|
75
75
|
if (params?.startDate) queryParams += `startDate=${params.startDate}&`;
|
|
76
76
|
if (params?.endDate) queryParams += `endDate=${params.endDate}&`;
|
|
77
77
|
if (params?.employeeId) queryParams += `employeeId=${params.employeeId}&`;
|
|
78
78
|
if (params?.pageNum) queryParams += `pageNum=${params.pageNum}&`;
|
|
79
79
|
if (params?.limit) queryParams += `limit=${params.limit}&`;
|
|
80
|
-
|
|
80
|
+
|
|
81
81
|
// Remove trailing '&'
|
|
82
82
|
queryParams = queryParams.slice(0, -1);
|
|
83
|
-
|
|
83
|
+
|
|
84
84
|
const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report`;
|
|
85
85
|
return await axiosInstance.get(url, config);
|
|
86
86
|
} catch (error) {
|
|
@@ -96,21 +96,24 @@ export const exportStoreReport = async function (this: WashdayClientInstance, st
|
|
|
96
96
|
}): Promise<any> {
|
|
97
97
|
try {
|
|
98
98
|
const config = {
|
|
99
|
-
headers: {
|
|
99
|
+
headers: {
|
|
100
100
|
Authorization: `Bearer ${this.apiToken}`,
|
|
101
|
-
'Content-Type': '
|
|
101
|
+
'Content-Type': 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
|
|
102
|
+
'Content-disposition': 'attachment; filename=[file.csv]'
|
|
102
103
|
},
|
|
103
|
-
|
|
104
|
+
params: {
|
|
105
|
+
responseType: 'blob'
|
|
106
|
+
}
|
|
104
107
|
};
|
|
105
|
-
|
|
108
|
+
|
|
106
109
|
let queryParams = '';
|
|
107
110
|
if (params?.startDate) queryParams += `startDate=${params.startDate}&`;
|
|
108
111
|
if (params?.endDate) queryParams += `endDate=${params.endDate}&`;
|
|
109
112
|
if (params?.employeeId) queryParams += `employeeId=${params.employeeId}&`;
|
|
110
|
-
|
|
113
|
+
|
|
111
114
|
// Remove trailing '&'
|
|
112
115
|
queryParams = queryParams.slice(0, -1);
|
|
113
|
-
|
|
116
|
+
|
|
114
117
|
const url = queryParams ? `${ATTENDANCE_API}/store/${storeId}/report/export?${queryParams}` : `${ATTENDANCE_API}/store/${storeId}/report/export`;
|
|
115
118
|
return await axiosInstance.get(url, config);
|
|
116
119
|
} catch (error) {
|