washday-sdk 0.0.13 → 0.0.15
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/stores/get.js +5 -1
- package/package.json +1 -1
- package/src/api/stores/get.ts +8 -2
package/dist/api/stores/get.js
CHANGED
|
@@ -18,11 +18,15 @@ const GET_SET_STORES = 'api/store';
|
|
|
18
18
|
const REQUEST_PARAMS = {
|
|
19
19
|
token: 'LOGGED_USER_TOKEN',
|
|
20
20
|
};
|
|
21
|
-
const getStores = function () {
|
|
21
|
+
const getStores = function (params) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
var _a, _b;
|
|
24
24
|
try {
|
|
25
25
|
REQUEST_PARAMS.token = this.apiToken;
|
|
26
|
+
let queryParams = '';
|
|
27
|
+
if (params.isActive) {
|
|
28
|
+
queryParams += `isActive=${params.isActive}`;
|
|
29
|
+
}
|
|
26
30
|
const response = yield axiosInstance_1.default.get(`${GET_SET_STORES}`, { params: Object.assign({}, REQUEST_PARAMS) });
|
|
27
31
|
return ((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.data) === null || _b === void 0 ? void 0 : _b.stores) || [];
|
|
28
32
|
}
|
package/package.json
CHANGED
package/src/api/stores/get.ts
CHANGED
|
@@ -7,10 +7,16 @@ const REQUEST_PARAMS = {
|
|
|
7
7
|
token: 'LOGGED_USER_TOKEN',
|
|
8
8
|
};
|
|
9
9
|
|
|
10
|
-
export const getStores = async function (this: WashdayClientInstance
|
|
10
|
+
export const getStores = async function (this: WashdayClientInstance, params: {
|
|
11
|
+
isActive?: string
|
|
12
|
+
}): Promise<{ stores: IStore[] }> {
|
|
11
13
|
try {
|
|
12
14
|
REQUEST_PARAMS.token = this.apiToken;
|
|
13
|
-
|
|
15
|
+
let queryParams = '';
|
|
16
|
+
if (params.isActive) {
|
|
17
|
+
queryParams += `isActive=${params.isActive}`
|
|
18
|
+
}
|
|
19
|
+
const response = await axiosInstance.get(`${GET_SET_STORES}?${queryParams}`, { params: { ...REQUEST_PARAMS } });
|
|
14
20
|
return response.data?.data?.stores || [];
|
|
15
21
|
} catch (error) {
|
|
16
22
|
console.error('Error fetching getStores:', error);
|