@nuskin/ns-product-lib 2.13.0-cx24-5107.2 → 2.13.0-cx24-5107.4

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,18 @@
1
+ # [2.13.0-cx24-5107.4](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.3...v2.13.0-cx24-5107.4) (2023-09-28)
2
+
3
+
4
+ ### Fix
5
+
6
+ * data structure issue ([e262ff6](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e262ff66889e28159a68bd7f6916a4bed5fe191c))
7
+ * productData ([fdf13c9](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/fdf13c9634c93a0413163cda297f2080457dad43))
8
+
9
+ # [2.13.0-cx24-5107.3](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.2...v2.13.0-cx24-5107.3) (2023-09-28)
10
+
11
+
12
+ ### Fix
13
+
14
+ * http request ([29f5933](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/29f593301621d1daf21b124dc044cc3ca439458e))
15
+
1
16
  # [2.13.0-cx24-5107.2](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.13.0-cx24-5107.1...v2.13.0-cx24-5107.2) (2023-09-28)
2
17
 
3
18
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.13.0-cx24-5107.2",
3
+ "version": "2.13.0-cx24-5107.4",
4
4
  "description": "This project contains shared Product models and code between the backend and frontend.",
5
5
  "main": "src/index.js",
6
6
  "scripts": {
@@ -15,9 +15,9 @@ const defaultPayload = {
15
15
  * @param {obj} payload
16
16
  * @returns {Promise}
17
17
  */
18
- const graphQlHttpRequest = (payload) => {
18
+ async function graphQlHttpRequest (payload) {
19
19
  const url = getGraphQlUrl();
20
- return axios.request({
20
+ return await axios.request({
21
21
  method: 'post',
22
22
  url: url,
23
23
  data: payload,
@@ -49,8 +49,9 @@ async function getProduct(id, market, locale, config) {
49
49
 
50
50
  try {
51
51
  const { data } = await graphQlHttpRequest(payload);
52
- if (data.productById) {
53
- const product = mapProduct(data.productById, market, locale, config);
52
+
53
+ if (data && data.data && data.data.productById) {
54
+ const product = mapProduct(data.data.productById, market, locale, config);
54
55
  productData.products.push(new Product(product));
55
56
  }
56
57
  } catch (e) {