washday-sdk 0.0.17 → 0.0.19

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.
@@ -20,8 +20,9 @@ const getAxiosInstance = () => {
20
20
  // Add interceptor to set token and other options for every request
21
21
  axiosInstance.interceptors.request.use((config) => {
22
22
  const { token, contentType = 'application/json', responseType = 'json', contentDisposition } = config.params || {};
23
+ const { Authorization } = config.headers || {};
23
24
  if (token) {
24
- config.headers.Authorization = `Bearer ${token}`;
25
+ config.headers.Authorization = Authorization || `Bearer ${token}`;
25
26
  }
26
27
  if (contentType) {
27
28
  config.headers['Content-Type'] = contentType;
@@ -22,8 +22,10 @@ const updateStoreById = function (storeId, data) {
22
22
  return __awaiter(this, void 0, void 0, function* () {
23
23
  var _a;
24
24
  try {
25
- REQUEST_PARAMS.token = this.apiToken;
26
- const response = yield axiosInstance_1.default.put(`${GET_SET_STORES}/${storeId}`, data, { params: Object.assign({}, REQUEST_PARAMS) });
25
+ const config = {
26
+ headers: { Authorization: `Bearer ${this.apiToken}` }
27
+ };
28
+ const response = yield axiosInstance_1.default.put(`${GET_SET_STORES}/${storeId}`, { config: config, data });
27
29
  return ((_a = response.data) === null || _a === void 0 ? void 0 : _a.data) || {};
28
30
  }
29
31
  catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "washday-sdk",
3
- "version": "0.0.17",
3
+ "version": "0.0.19",
4
4
  "description": "Washday utilities functions and API",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -20,8 +20,9 @@ const getAxiosInstance = (): AxiosInstance => {
20
20
  axiosInstance.interceptors.request.use(
21
21
  (config) => {
22
22
  const { token, contentType = 'application/json', responseType = 'json', contentDisposition } = config.params || {};
23
+ const { Authorization } = config.headers || {};
23
24
  if (token) {
24
- config.headers.Authorization = `Bearer ${token}`;
25
+ config.headers.Authorization = Authorization || `Bearer ${token}`;
25
26
  }
26
27
  if (contentType) {
27
28
  config.headers['Content-Type'] = contentType;
@@ -6,10 +6,13 @@ const REQUEST_PARAMS = {
6
6
  token: 'LOGGED_USER_TOKEN',
7
7
  };
8
8
 
9
+
9
10
  export const updateStoreById = async function (this: WashdayClientInstance, storeId: string, data: IStore): Promise<{ store: IStore }> {
10
11
  try {
11
- REQUEST_PARAMS.token = this.apiToken;
12
- const response = await axiosInstance.put(`${GET_SET_STORES}/${storeId}`, data, { params: { ...REQUEST_PARAMS } });
12
+ const config = {
13
+ headers: { Authorization: `Bearer ${this.apiToken}` }
14
+ };
15
+ const response = await axiosInstance.put(`${GET_SET_STORES}/${storeId}`, { config: config, data });
13
16
  return response.data?.data || {}
14
17
  } catch (error) {
15
18
  console.error('Error fetching getStoreById:', error);