@griddo/cx 1.75.177 → 1.75.179
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/package.json +3 -3
- package/src/api/index.js +25 -12
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.179",
|
|
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.179",
|
|
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": "82fe9cc463133b563a8e33aaa2a4103e0c0cb27f"
|
|
102
102
|
}
|
package/src/api/index.js
CHANGED
|
@@ -15,9 +15,15 @@ const getApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
15
15
|
|
|
16
16
|
if (cached) {
|
|
17
17
|
const cachedResponse = getCache(cacheOptions);
|
|
18
|
-
console.log(`API CALL CACHED: GET ${endpoint} ${new Date() - starts} ms`);
|
|
19
18
|
|
|
20
|
-
if (cachedResponse)
|
|
19
|
+
if (cachedResponse) {
|
|
20
|
+
console.log(
|
|
21
|
+
`API CALL CACHED: GET ${endpoint}${
|
|
22
|
+
cachedResponse?.site ? ` (SITE: ${cachedResponse?.site})` : ''
|
|
23
|
+
} ${new Date() - starts} ms`
|
|
24
|
+
);
|
|
25
|
+
return cachedResponse;
|
|
26
|
+
}
|
|
21
27
|
}
|
|
22
28
|
|
|
23
29
|
try {
|
|
@@ -27,7 +33,11 @@ const getApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
27
33
|
headers: { ...auth.headers },
|
|
28
34
|
data: body,
|
|
29
35
|
});
|
|
30
|
-
console.log(
|
|
36
|
+
console.log(
|
|
37
|
+
`API CALL ENDS: GET ${endpoint}${
|
|
38
|
+
data?.site ? ` (SITE: ${data?.site})` : ''
|
|
39
|
+
} ${new Date() - starts} ms`
|
|
40
|
+
);
|
|
31
41
|
saveCache(cacheOptions, data);
|
|
32
42
|
|
|
33
43
|
return data;
|
|
@@ -51,9 +61,11 @@ const putApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
51
61
|
|
|
52
62
|
if (cached) {
|
|
53
63
|
const cachedResponse = getCache(cacheOptions);
|
|
54
|
-
console.log(`API CALL CACHED: PUT ${endpoint} ${new Date() - starts} ms`);
|
|
55
64
|
|
|
56
|
-
if (cachedResponse)
|
|
65
|
+
if (cachedResponse) {
|
|
66
|
+
console.log(`API CALL CACHED: PUT ${endpoint} ${new Date() - starts} ms`);
|
|
67
|
+
return cachedResponse;
|
|
68
|
+
}
|
|
57
69
|
}
|
|
58
70
|
|
|
59
71
|
try {
|
|
@@ -93,13 +105,14 @@ const postApi = async (endpoint, body, headers, cached, attempt = 0) => {
|
|
|
93
105
|
if (cached) {
|
|
94
106
|
const cachedResponse = getCache(cacheOptions);
|
|
95
107
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
108
|
+
if (cachedResponse) {
|
|
109
|
+
console.log(
|
|
110
|
+
`API CALL CACHED: POST ${endpoint} ${
|
|
111
|
+
new Date() - starts
|
|
112
|
+
} ms ${distributorBodyParams}`
|
|
113
|
+
);
|
|
114
|
+
return cachedResponse;
|
|
115
|
+
}
|
|
103
116
|
}
|
|
104
117
|
|
|
105
118
|
try {
|