@mjhls/mjh-framework 1.0.652 → 1.0.653

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/README.md CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- # mjh-framework v. 1.0.652
2
+ # mjh-framework v. 1.0.653
3
3
 
4
4
  > Foundation Framework
5
5
 
@@ -41,6 +41,9 @@ var getRelatedArticle = function () {
41
41
  var path = _ref3.path,
42
42
  _id = _ref3._id;
43
43
 
44
+ if (!_id || typeof _id == 'undefined') {
45
+ return null;
46
+ }
44
47
  var prev_url_to_check = prevUrl;
45
48
  if (prev_url_to_check.includes('?')) {
46
49
  prev_url_to_check = prev_url_to_check.split('?')[0];
@@ -51,11 +54,15 @@ var getRelatedArticle = function () {
51
54
 
52
55
  //404 articles were throwing server error
53
56
  if (taxonomy.length === 0 && taxonomyMapping) {
54
- taxonomy = taxonomyMapping.map(function (_ref4) {
57
+ taxonomyMapping.forEach(function (_ref4) {
55
58
  var _ref = _ref4._ref;
56
- return _ref;
59
+
60
+ if (_ref) {
61
+ taxonomy.push(_ref);
62
+ }
57
63
  });
58
64
  }
65
+
59
66
  params = {
60
67
  url: url,
61
68
  taxonomy: taxonomy,
@@ -73,14 +80,16 @@ var getRelatedArticle = function () {
73
80
  } else nookies.setCookie(ctx, 'prevSlugs', '"' + url + '"', {});
74
81
  }
75
82
  relatedArticleQuery = getQuery('related', conditions, '', articleCount);
76
- _context.next = 12;
83
+
84
+ console.log(relatedArticleQuery, params);
85
+ _context.next = 13;
77
86
  return client.fetch(relatedArticleQuery, params);
78
87
 
79
- case 12:
88
+ case 13:
80
89
  relatedArticle = _context.sent;
81
90
  return _context.abrupt('return', relatedArticle);
82
91
 
83
- case 14:
92
+ case 15:
84
93
  case 'end':
85
94
  return _context.stop();
86
95
  }
@@ -39,6 +39,9 @@ var getRelatedArticle = function () {
39
39
  var path = _ref3.path,
40
40
  _id = _ref3._id;
41
41
 
42
+ if (!_id || typeof _id == 'undefined') {
43
+ return null;
44
+ }
42
45
  var prev_url_to_check = prevUrl;
43
46
  if (prev_url_to_check.includes('?')) {
44
47
  prev_url_to_check = prev_url_to_check.split('?')[0];
@@ -49,11 +52,15 @@ var getRelatedArticle = function () {
49
52
 
50
53
  //404 articles were throwing server error
51
54
  if (taxonomy.length === 0 && taxonomyMapping) {
52
- taxonomy = taxonomyMapping.map(function (_ref4) {
55
+ taxonomyMapping.forEach(function (_ref4) {
53
56
  var _ref = _ref4._ref;
54
- return _ref;
57
+
58
+ if (_ref) {
59
+ taxonomy.push(_ref);
60
+ }
55
61
  });
56
62
  }
63
+
57
64
  params = {
58
65
  url: url,
59
66
  taxonomy: taxonomy,
@@ -71,14 +78,16 @@ var getRelatedArticle = function () {
71
78
  } else setCookie(ctx, 'prevSlugs', '"' + url + '"', {});
72
79
  }
73
80
  relatedArticleQuery = getQuery('related', conditions, '', articleCount);
74
- _context.next = 12;
81
+
82
+ console.log(relatedArticleQuery, params);
83
+ _context.next = 13;
75
84
  return client.fetch(relatedArticleQuery, params);
76
85
 
77
- case 12:
86
+ case 13:
78
87
  relatedArticle = _context.sent;
79
88
  return _context.abrupt('return', relatedArticle);
80
89
 
81
- case 14:
90
+ case 15:
82
91
  case 'end':
83
92
  return _context.stop();
84
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mjhls/mjh-framework",
3
- "version": "1.0.652",
3
+ "version": "1.0.653",
4
4
  "description": "Foundation Framework",
5
5
  "author": "mjh-framework",
6
6
  "license": "MIT",