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.
@@ -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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.13",
3
+ "version": "0.0.15",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -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): Promise<{ stores: IStore[] }> {
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
- const response = await axiosInstance.get(`${GET_SET_STORES}`, { params: { ...REQUEST_PARAMS } });
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);