ti2 1.0.55 → 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.
@@ -11,7 +11,7 @@ const {
11
11
  },
12
12
  } = process;
13
13
 
14
- const invalid = (res, msg) => res.status(401).json({ error: msg || 'Unauthorized' });
14
+ const invalid = (res, msg) => res.status(401).send({ error: msg || 'Unauthorized' });
15
15
 
16
16
  const getToken = ({ req }) => {
17
17
  if (
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
- cache.save({
213
- pluginName: req.pathParams.appKey,
214
- key: cacheKey,
215
- value: newData,
216
- ttl: 60 * 60 * 24, // one day
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);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ti2",
3
- "version": "1.0.55",
3
+ "version": "1.0.56",
4
4
  "description": "Tourist Industry Exchange (TI2)",
5
5
  "main": "index.js",
6
6
  "scripts": {