@griddo/cx 1.75.172 → 1.75.174
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/gatsby-node.js +6 -3
- package/package.json +3 -3
- package/src/api/index.js +13 -6
package/gatsby-node.js
CHANGED
|
@@ -182,12 +182,15 @@ exports.createPages = async ({ actions }) => {
|
|
|
182
182
|
helpers.log('info', 'VALID PAGES -->', validPagesIds);
|
|
183
183
|
|
|
184
184
|
const renderPageProcess = async pageId => {
|
|
185
|
-
const pageAdditionalInfo = JSON.parse(JSON.stringify(additionalInfo));
|
|
186
|
-
createdPages.push(pageId);
|
|
187
|
-
|
|
188
185
|
// Get page data
|
|
189
186
|
const page = await SitesService.getPage(pageId, cache);
|
|
190
187
|
|
|
188
|
+
if (!page) return;
|
|
189
|
+
|
|
190
|
+
createdPages.push(pageId);
|
|
191
|
+
|
|
192
|
+
const pageAdditionalInfo = JSON.parse(JSON.stringify(additionalInfo));
|
|
193
|
+
|
|
191
194
|
helpers.log(
|
|
192
195
|
'info',
|
|
193
196
|
`RENDERING PAGE ${pageId} -->`,
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/cx",
|
|
3
3
|
"description": "Griddo SSG based on Gatsby",
|
|
4
|
-
"version": "1.75.
|
|
4
|
+
"version": "1.75.174",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -66,7 +66,7 @@
|
|
|
66
66
|
"react-helmet": "^6.0.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@griddo/eslint-config-back": "^1.75.
|
|
69
|
+
"@griddo/eslint-config-back": "^1.75.174",
|
|
70
70
|
"eslint": "^7.5.0",
|
|
71
71
|
"eslint-plugin-node": "^11.1.0",
|
|
72
72
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "67875dc3507d11389793aa9d3613c3479d1fa125"
|
|
102
102
|
}
|
package/src/api/index.js
CHANGED
|
@@ -32,7 +32,9 @@ const getApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
32
32
|
|
|
33
33
|
return data;
|
|
34
34
|
} catch (e) {
|
|
35
|
-
showApiError(e, { endpoint, body, attempt });
|
|
35
|
+
showApiError(e, { endpoint, body, attempt }, e.response.status !== 404);
|
|
36
|
+
|
|
37
|
+
if (e.response.status === 404) return null;
|
|
36
38
|
|
|
37
39
|
if (attempt < parseInt(RETRY_ATTEMPTS)) {
|
|
38
40
|
console.log('WAITING FOR RETRY: GET', endpoint);
|
|
@@ -66,7 +68,9 @@ const putApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
66
68
|
|
|
67
69
|
return data;
|
|
68
70
|
} catch (e) {
|
|
69
|
-
showApiError(e, { endpoint, body, attempt });
|
|
71
|
+
showApiError(e, { endpoint, body, attempt }, e.response.status !== 404);
|
|
72
|
+
|
|
73
|
+
if (e.response.status === 404) return null;
|
|
70
74
|
|
|
71
75
|
if (attempt < parseInt(RETRY_ATTEMPTS)) {
|
|
72
76
|
console.log('WAITING FOR RETRY: PUT', endpoint);
|
|
@@ -115,7 +119,9 @@ const postApi = async (endpoint, body, headers, cached, attempt = 0) => {
|
|
|
115
119
|
|
|
116
120
|
return data;
|
|
117
121
|
} catch (e) {
|
|
118
|
-
showApiError(e, { endpoint, body,
|
|
122
|
+
showApiError(e, { endpoint, body, attempt }, e.response.status !== 404);
|
|
123
|
+
|
|
124
|
+
if (e.response.status === 404) return null;
|
|
119
125
|
|
|
120
126
|
if (attempt < parseInt(RETRY_ATTEMPTS)) {
|
|
121
127
|
console.log('WAITING FOR RETRY: POST', endpoint);
|
|
@@ -126,7 +132,7 @@ const postApi = async (endpoint, body, headers, cached, attempt = 0) => {
|
|
|
126
132
|
}
|
|
127
133
|
};
|
|
128
134
|
|
|
129
|
-
const showApiError = (e, callInfo = {}) => {
|
|
135
|
+
const showApiError = (e, callInfo = {}, breakProcess = true) => {
|
|
130
136
|
const { response, message, stack } = e;
|
|
131
137
|
const { status, statusText, data } = response || {};
|
|
132
138
|
const callInfoArray = [];
|
|
@@ -154,8 +160,9 @@ const showApiError = (e, callInfo = {}) => {
|
|
|
154
160
|
);
|
|
155
161
|
|
|
156
162
|
if (
|
|
157
|
-
|
|
158
|
-
callInfo
|
|
163
|
+
breakProcess &&
|
|
164
|
+
(typeof callInfo?.attempt !== 'number' ||
|
|
165
|
+
callInfo.attempt >= parseInt(RETRY_ATTEMPTS))
|
|
159
166
|
)
|
|
160
167
|
process.exit(1);
|
|
161
168
|
};
|