@websolutespa/bom-mixer-hooks 1.7.4 → 1.7.5
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/CHANGELOG.md +8 -0
- package/dist/index.js +1 -1
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/src/useApi/useApi.test.tsx +2 -2
- package/src/useCollectionApi/local.collection.ts +2 -2
- package/src/useCollectionApi/useCollectionApi.test.tsx +2 -2
- package/src/useHttp/useHttp.test.tsx +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.js
CHANGED
|
@@ -624,7 +624,7 @@ function localCollectionFetch(_0) {
|
|
|
624
624
|
url.searchParams.append("locale", serviceOptions.locale);
|
|
625
625
|
url.searchParams.append("market", serviceOptions.market);
|
|
626
626
|
}
|
|
627
|
-
const apiOptions = (0, import_bom_core3.merge)(__spreadValues({}, (0, import_bom_mixer_store2.
|
|
627
|
+
const apiOptions = (0, import_bom_core3.merge)(__spreadValues({}, (0, import_bom_mixer_store2.getLocalApiRequestOptions)()), options);
|
|
628
628
|
const apiResponse = yield (0, import_bom_core3.httpFetch)(url.href, apiOptions);
|
|
629
629
|
return apiResponse;
|
|
630
630
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -472,7 +472,7 @@ function useClickOut(ref, handler) {
|
|
|
472
472
|
|
|
473
473
|
// src/useCollectionApi/local.collection.ts
|
|
474
474
|
import { httpFetch as httpFetch2, merge } from "@websolutespa/bom-core";
|
|
475
|
-
import {
|
|
475
|
+
import { getLocalApiRequestOptions, getLocalApiUrl } from "@websolutespa/bom-mixer-store";
|
|
476
476
|
function localCollectionFetch(_0) {
|
|
477
477
|
return __async(this, arguments, function* (pathname, options = {}, serviceOptions) {
|
|
478
478
|
const url = new URL(getLocalApiUrl(pathname));
|
|
@@ -480,7 +480,7 @@ function localCollectionFetch(_0) {
|
|
|
480
480
|
url.searchParams.append("locale", serviceOptions.locale);
|
|
481
481
|
url.searchParams.append("market", serviceOptions.market);
|
|
482
482
|
}
|
|
483
|
-
const apiOptions = merge(__spreadValues({},
|
|
483
|
+
const apiOptions = merge(__spreadValues({}, getLocalApiRequestOptions()), options);
|
|
484
484
|
const apiResponse = yield httpFetch2(url.href, apiOptions);
|
|
485
485
|
return apiResponse;
|
|
486
486
|
});
|
package/package.json
CHANGED
|
@@ -38,7 +38,7 @@ function mockFetch(
|
|
|
38
38
|
method: string;
|
|
39
39
|
} = {
|
|
40
40
|
headers: {
|
|
41
|
-
'Authorization': '
|
|
41
|
+
'Authorization': 'users API-Key STORE_API_KEY',
|
|
42
42
|
'Content-Type': 'application/json',
|
|
43
43
|
},
|
|
44
44
|
method,
|
|
@@ -66,7 +66,7 @@ describe('useApi', () => {
|
|
|
66
66
|
STORE_URL: 'http://localhost:4000',
|
|
67
67
|
STORE_API: '/bowl/api',
|
|
68
68
|
STORE_STRATEGY: 'mock',
|
|
69
|
-
|
|
69
|
+
STORE_API_KEY: 'STORE_API_KEY',
|
|
70
70
|
SECRET_COOKIE_PASSWORD: 'SECRET_COOKIE_PASSWORD_32_CHARS_LONG',
|
|
71
71
|
HOOKS_SECRET: 'HOOKS_SECRET',
|
|
72
72
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { httpFetch, merge } from '@websolutespa/bom-core';
|
|
2
|
-
import { ApiRequestOptions,
|
|
2
|
+
import { ApiRequestOptions, getLocalApiRequestOptions, getLocalApiUrl } from '@websolutespa/bom-mixer-store';
|
|
3
3
|
|
|
4
4
|
export async function localCollectionFetch<T = unknown>(pathname: string, options: ApiRequestOptions = {}, serviceOptions?: { locale: string, market: string }): Promise<T> {
|
|
5
5
|
const url = new URL(getLocalApiUrl(pathname));
|
|
@@ -7,7 +7,7 @@ export async function localCollectionFetch<T = unknown>(pathname: string, option
|
|
|
7
7
|
url.searchParams.append('locale', serviceOptions.locale);
|
|
8
8
|
url.searchParams.append('market', serviceOptions.market);
|
|
9
9
|
}
|
|
10
|
-
const apiOptions = merge({ ...
|
|
10
|
+
const apiOptions = merge({ ...getLocalApiRequestOptions() }, options);
|
|
11
11
|
const apiResponse = await httpFetch(url.href, apiOptions);
|
|
12
12
|
return apiResponse;
|
|
13
13
|
}
|
|
@@ -39,7 +39,7 @@ function mockFetch(
|
|
|
39
39
|
method: string;
|
|
40
40
|
} = {
|
|
41
41
|
headers: {
|
|
42
|
-
'Authorization': '
|
|
42
|
+
'Authorization': 'users API-Key STORE_API_KEY',
|
|
43
43
|
'Content-Type': 'application/json',
|
|
44
44
|
},
|
|
45
45
|
method,
|
|
@@ -67,7 +67,7 @@ describe('useCollectionApi', () => {
|
|
|
67
67
|
STORE_URL: 'http://localhost:4000',
|
|
68
68
|
STORE_API: '/bowl/api',
|
|
69
69
|
STORE_STRATEGY: 'mock',
|
|
70
|
-
|
|
70
|
+
STORE_API_KEY: 'STORE_API_KEY',
|
|
71
71
|
SECRET_COOKIE_PASSWORD: 'SECRET_COOKIE_PASSWORD_32_CHARS_LONG',
|
|
72
72
|
HOOKS_SECRET: 'HOOKS_SECRET',
|
|
73
73
|
};
|
|
@@ -57,7 +57,7 @@ describe('useHttp', () => {
|
|
|
57
57
|
STORE_URL: 'http://localhost:4000',
|
|
58
58
|
STORE_API: '/bowl/api',
|
|
59
59
|
STORE_STRATEGY: 'mock',
|
|
60
|
-
|
|
60
|
+
STORE_API_KEY: 'STORE_API_KEY',
|
|
61
61
|
SECRET_COOKIE_PASSWORD: 'SECRET_COOKIE_PASSWORD_32_CHARS_LONG',
|
|
62
62
|
HOOKS_SECRET: 'HOOKS_SECRET',
|
|
63
63
|
};
|