@nuskin/ns-product-lib 2.13.0-cx24-5107.1 → 2.13.0-cx24-5107.3
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 +14 -0
- package/package.json +1 -1
- package/src/graph-ql/product.js +7 -4
package/CHANGELOG.md
CHANGED
@@ -1,3 +1,17 @@
|
|
1
|
+
# [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)
|
2
|
+
|
3
|
+
|
4
|
+
### Fix
|
5
|
+
|
6
|
+
* http request ([29f5933](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/29f593301621d1daf21b124dc044cc3ca439458e))
|
7
|
+
|
8
|
+
# [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)
|
9
|
+
|
10
|
+
|
11
|
+
### Fix
|
12
|
+
|
13
|
+
* empty productById ([e4e455c](https://code.tls.nuskin.io/ns-am/product/js-libs/ns-product-lib/commit/e4e455c34bae3558a429e4cce7c3226517ed6631))
|
14
|
+
|
1
15
|
# [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
16
|
|
3
17
|
|
package/package.json
CHANGED
package/src/graph-ql/product.js
CHANGED
@@ -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",
|
@@ -14,9 +15,9 @@ const defaultPayload = {
|
|
14
15
|
* @param {obj} payload
|
15
16
|
* @returns {Promise}
|
16
17
|
*/
|
17
|
-
|
18
|
+
async function graphQlHttpRequest (payload) {
|
18
19
|
const url = getGraphQlUrl();
|
19
|
-
return
|
20
|
+
return await axios.request({
|
20
21
|
method: 'post',
|
21
22
|
url: url,
|
22
23
|
data: payload,
|
@@ -48,8 +49,10 @@ async function getProduct(id, market, locale, config) {
|
|
48
49
|
|
49
50
|
try {
|
50
51
|
const { data } = await graphQlHttpRequest(payload);
|
51
|
-
|
52
|
-
|
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
|
}
|