washday-sdk 0.0.18 → 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;
|
package/dist/api/stores/put.js
CHANGED
|
@@ -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
|
-
|
|
26
|
-
|
|
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
package/src/api/axiosInstance.ts
CHANGED
|
@@ -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;
|
package/src/api/stores/put.ts
CHANGED
|
@@ -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
|
-
|
|
12
|
-
|
|
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);
|