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

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [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
+
3
+
4
+ ### Fix
5
+
6
+ * empty productById ([e4e455c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e4e455c34bae3558a429e4cce7c3226517ed6631))
7
+
1
8
  # [2.13.0-cx24-5107.1](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/compare/v2.12.0...v2.13.0-cx24-5107.1) (2023-09-28)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/ns-product-lib",
3
- "version": "2.13.0-cx24-5107.1",
3
+ "version": "2.13.0-cx24-5107.2",
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": {
@@ -3,6 +3,7 @@ const { getProductByIdQuery } = require('./query');
3
3
  const getGraphQlUrl = require('./graphQlUrl')
4
4
  const ProductStatus = require("../models/productStatus");
5
5
  const CustomerTypes = require('./customerTypes');
6
+ const Product = require("../product");
6
7
 
7
8
  const defaultPayload = {
8
9
  operationName: "getProduct",
@@ -48,8 +49,10 @@ async function getProduct(id, market, locale, config) {
48
49
 
49
50
  try {
50
51
  const { data } = await graphQlHttpRequest(payload);
51
- const product = mapProduct(data.productById, market, locale, config);
52
- productData.products.push(product);
52
+ if (data.productById) {
53
+ const product = mapProduct(data.productById, market, locale, config);
54
+ productData.products.push(new Product(product));
55
+ }
53
56
  } catch (e) {
54
57
  console.log(e);
55
58
  }