ti2 1.0.54 → 1.0.56
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/auth/authHandler.js +1 -1
- package/index.js +9 -9
- package/package.json +1 -1
package/auth/authHandler.js
CHANGED
package/index.js
CHANGED
|
@@ -15,7 +15,6 @@ const EventEmitter = require('eventemitter2');
|
|
|
15
15
|
|
|
16
16
|
const cacheSettings = {
|
|
17
17
|
'*': [
|
|
18
|
-
'tokenTemplate',
|
|
19
18
|
'getAffiliateAgents',
|
|
20
19
|
'getAffiliateDesks',
|
|
21
20
|
'getPickupPoints',
|
|
@@ -209,12 +208,14 @@ module.exports = async ({
|
|
|
209
208
|
}
|
|
210
209
|
const realSend = res.json;
|
|
211
210
|
res.json = newData => { // new res.json
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
211
|
+
if (res.statusCode === 200) {
|
|
212
|
+
cache.save({
|
|
213
|
+
pluginName: req.pathParams.appKey,
|
|
214
|
+
key: cacheKey,
|
|
215
|
+
value: newData,
|
|
216
|
+
ttl: 60 * 60 * 24, // one day
|
|
217
|
+
});
|
|
218
|
+
}
|
|
218
219
|
// console.log('newData', cacheKey);
|
|
219
220
|
if (!res.headersSent) {
|
|
220
221
|
// console.log('send new data', cacheKey);
|
|
@@ -237,12 +238,11 @@ module.exports = async ({
|
|
|
237
238
|
if (process.env.CONSOLE_ERRORS || process.env.JEST_WORKER_ID) {
|
|
238
239
|
console.error(R.path(['response', 'data'], err), err);
|
|
239
240
|
}
|
|
240
|
-
console.log('hit hre');
|
|
241
241
|
return res.status((() => {
|
|
242
242
|
if (!isNumber(err.status)) return 500;
|
|
243
243
|
return Number(err.status);
|
|
244
244
|
})()).send({
|
|
245
|
-
message: R.path(['response', 'data', 'errorMessage'], err) || err.message || 'Internal Error',
|
|
245
|
+
message: typeof err === 'string' ? err : (R.path(['response', 'data', 'errorMessage'], err) || err.message || 'Internal Error'),
|
|
246
246
|
});
|
|
247
247
|
});
|
|
248
248
|
});
|