...
|
...
|
@@ -11,7 +11,7 @@ const url = require('url'); |
|
|
|
|
|
const findBySkn = (skn) => {
|
|
|
return api.getProductBySknAsync(skn).then((result) => {
|
|
|
if (result.code === 200 && result.data.product_url) {
|
|
|
if (result && result.code && result.code === 200 && result.data.product_url) {
|
|
|
return {
|
|
|
url: url.parse(_.get(result, 'data.product_url', '')).path
|
|
|
};
|
...
|
...
|
@@ -23,7 +23,7 @@ const findBySkn = (skn) => { |
|
|
|
|
|
const findBySku = (sku) => {
|
|
|
return api.getProductBySkuAsync(`[${sku}]`).then((result) => {
|
|
|
if (result.code === 200 && !_.isEmpty(result.data)) {
|
|
|
if (result && result.code && result.code === 200 && !_.isEmpty(result.data)) {
|
|
|
let product = _.head(result.data) || {};
|
|
|
let skn = product.erpProductId || '';
|
|
|
|
...
|
...
|
|