@griddo/cx 1.75.155 → 1.75.157
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 +4 -4
- package/src/api/index.js +9 -0
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.157",
|
|
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.157",
|
|
70
70
|
"eslint": "^7.5.0",
|
|
71
71
|
"eslint-plugin-node": "^11.1.0",
|
|
72
72
|
"eslint-plugin-react": "7.14.3",
|
|
@@ -78,7 +78,7 @@
|
|
|
78
78
|
"react-dom": "*"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
|
-
"node": ">=
|
|
81
|
+
"node": ">=16.17.0"
|
|
82
82
|
},
|
|
83
83
|
"files": [
|
|
84
84
|
".babelrc",
|
|
@@ -98,5 +98,5 @@
|
|
|
98
98
|
"publishConfig": {
|
|
99
99
|
"access": "public"
|
|
100
100
|
},
|
|
101
|
-
"gitHead": "
|
|
101
|
+
"gitHead": "91898dc56560e90731dcba47458d225558440b5f"
|
|
102
102
|
}
|
package/src/api/index.js
CHANGED
|
@@ -11,8 +11,10 @@ const {
|
|
|
11
11
|
|
|
12
12
|
const getApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
13
13
|
const cacheOptions = { endpoint, body, cached };
|
|
14
|
+
const starts = new Date();
|
|
14
15
|
if (cached) {
|
|
15
16
|
const cachedResponse = getCache(cacheOptions);
|
|
17
|
+
console.log(`API CALL CACHED: GET ${endpoint} ${new Date() - starts} ms`);
|
|
16
18
|
if (cachedResponse) return cachedResponse;
|
|
17
19
|
}
|
|
18
20
|
try {
|
|
@@ -22,6 +24,7 @@ const getApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
22
24
|
headers: { ...auth.headers },
|
|
23
25
|
data: body,
|
|
24
26
|
});
|
|
27
|
+
console.log(`API CALL ENDS: GET ${endpoint} ${new Date() - starts} ms`);
|
|
25
28
|
saveCache(cacheOptions, data);
|
|
26
29
|
return data;
|
|
27
30
|
} catch (e) {
|
|
@@ -36,8 +39,10 @@ const getApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
36
39
|
|
|
37
40
|
const putApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
38
41
|
const cacheOptions = { endpoint, body, cached };
|
|
42
|
+
const starts = new Date();
|
|
39
43
|
if (cached) {
|
|
40
44
|
const cachedResponse = getCache(cacheOptions);
|
|
45
|
+
console.log(`API CALL CACHED: PUT ${endpoint} ${new Date() - starts} ms`);
|
|
41
46
|
if (cachedResponse) return cachedResponse;
|
|
42
47
|
}
|
|
43
48
|
try {
|
|
@@ -47,6 +52,7 @@ const putApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
47
52
|
headers: { ...auth.headers },
|
|
48
53
|
data: body,
|
|
49
54
|
});
|
|
55
|
+
console.log(`API CALL ENDS: PUT ${endpoint} ${new Date() - starts} ms`);
|
|
50
56
|
saveCache(cacheOptions, data);
|
|
51
57
|
return data;
|
|
52
58
|
} catch (e) {
|
|
@@ -61,8 +67,10 @@ const putApi = async (endpoint, body, cached = false, attempt = 0) => {
|
|
|
61
67
|
|
|
62
68
|
const postApi = async (endpoint, body, headers, cached, attempt = 0) => {
|
|
63
69
|
const cacheOptions = { endpoint, body, headers, cached };
|
|
70
|
+
const starts = new Date();
|
|
64
71
|
if (cached) {
|
|
65
72
|
const cachedResponse = getCache(cacheOptions);
|
|
73
|
+
console.log(`API CALL CACHED: POST ${endpoint} ${new Date() - starts} ms`);
|
|
66
74
|
if (cachedResponse) return cachedResponse;
|
|
67
75
|
}
|
|
68
76
|
try {
|
|
@@ -72,6 +80,7 @@ const postApi = async (endpoint, body, headers, cached, attempt = 0) => {
|
|
|
72
80
|
headers: { ...headers, ...auth.headers },
|
|
73
81
|
data: body,
|
|
74
82
|
});
|
|
83
|
+
console.log(`API CALL ENDS: POST ${endpoint} ${new Date() - starts} ms`);
|
|
75
84
|
saveCache(cacheOptions, data);
|
|
76
85
|
return data;
|
|
77
86
|
} catch (e) {
|