hof 21.0.8-axios-beta → 21.0.10-axios-beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/model/index.js +13 -25
  2. package/package.json +1 -1
package/model/index.js CHANGED
@@ -41,7 +41,6 @@ module.exports = class Model extends EventEmitter {
41
41
  }
42
42
 
43
43
  return this.prepare().then(data => {
44
- console.log("after prepare promise")
45
44
  data = JSON.stringify(data);
46
45
  const reqConf = this.requestConfig(options);
47
46
  reqConf.method = options.method || 'POST';
@@ -122,7 +121,6 @@ module.exports = class Model extends EventEmitter {
122
121
  return new Promise((resolve, reject) => {
123
122
  const _callback = (err, data, statusCode) => {
124
123
  if (timeoutTimer) {
125
- console.log("heerrererererer222")
126
124
  clearTimeout(timeoutTimer);
127
125
  timeoutTimer = null;
128
126
  }
@@ -130,40 +128,34 @@ module.exports = class Model extends EventEmitter {
130
128
  const endTime = process.hrtime();
131
129
  const responseTime = timeDiff(startTime, endTime);
132
130
  if (err) {
133
- console.log("heerrererererer444")
134
- console.log("d",data)
135
- console.log("e",err)
136
- console.log("os", originalSettings)
137
- console.log("sc", statusCode)
138
- console.log("rt", responseTime)
139
- console.log("heerrererererer444")
140
- this.emit('fail', err, data, originalSettings, statusCode, responseTime);
141
- } else {
142
- console.log("heerrererererer555")
143
- this.emit('success', data, originalSettings, statusCode, responseTime);
144
- }
145
- if (err) {
146
- console.log("err11")
131
+ console.log("*****ERRR********")
147
132
  console.log(err)
148
- console.log("err11")
133
+ console.log("*****ERRR********")
134
+ this.emit('fail', err, data, originalSettings, statusCode, responseTime);
149
135
  reject(err);
150
136
  } else {
137
+ console.log("SUCCESS>>>>>>>>>>>>>>>")
138
+ this.emit('success', data, originalSettings, statusCode, responseTime);
151
139
  resolve(data);
152
140
  }
141
+ // if (err) {
142
+ // console.log("err11")
143
+ // console.log(err)
144
+ // console.log("err11")
145
+ // reject(err);
146
+ // } else {
147
+ // resolve(data);
148
+ // }
153
149
  };
154
- console.log("settings---------------: ", settings);
155
150
  this._request(settings)
156
151
  .then(response => {
157
- console.log("heeeeeeyyy123")
158
152
  return this.handleResponse(response, (error, data, status) => {
159
- console.log("heeeeeeyyyy912")
160
153
  if (error) {
161
154
  error.headers = response.headers;
162
155
  }
163
156
  _callback(error, data, status);
164
157
  });
165
158
  }).catch(err => {
166
- console.log("heerrererererer111")
167
159
  if (err.code === 'ETIMEDOUT' || err.code === 'ESOCKETTIMEDOUT') {
168
160
  err.message = 'Connection timed out';
169
161
  err.status = 504;
@@ -181,13 +173,10 @@ module.exports = class Model extends EventEmitter {
181
173
  }
182
174
 
183
175
  handleResponse(response, callback) {
184
- console.log("handleresponse.....><<>")
185
176
  let data = {};
186
177
  try {
187
- console.log("TRYhandleresponse.....><<>")
188
178
  data = typeof response.data === 'object' ? response.data : JSON.parse(response.data || '{}');
189
179
  } catch (err) {
190
- console.log("CATCHhandleresponse.....><<>")
191
180
  err.status = response.status;
192
181
  err.body = response.data;
193
182
  return callback(err, null, response.status);
@@ -209,7 +198,6 @@ module.exports = class Model extends EventEmitter {
209
198
  }
210
199
 
211
200
  prepare() {
212
- console.log("prepare() promise")
213
201
  return Promise.resolve(this.toJSON());
214
202
  }
215
203
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "hof",
3
3
  "description": "A bootstrap for HOF projects",
4
- "version": "21.0.8-axios-beta",
4
+ "version": "21.0.10-axios-beta",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",