hof 21.0.16-axios-beta → 21.0.18-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 +12 -14
  2. package/package.json +1 -1
package/model/index.js CHANGED
@@ -103,14 +103,15 @@ module.exports = class Model extends EventEmitter {
103
103
  const promise = Promise.resolve().then(() => this.auth()).then(authData => {
104
104
  console.log("@@@@@@@@@@@@@@@@")
105
105
  console.log(authData)
106
- console.log(typeof authData)
107
106
  console.log("@@@@@@@@@@@@@@@@")
108
107
  let authVal = authData;
109
- const auth = authVal.split(':');
110
- authVal = {
111
- username: auth.shift(),
112
- password: auth.join(':')
113
- };
108
+ if (typeof authVal === 'string') {
109
+ const auth = authVal.split(':');
110
+ authVal = {
111
+ username: auth.shift(),
112
+ password: auth.join(':')
113
+ };
114
+ }
114
115
  if(authVal) {
115
116
  settings.headers = Object.assign({}, settings.headers, {Authorization: `Bearer ${authVal.bearer}`});
116
117
  }
@@ -142,14 +143,11 @@ module.exports = class Model extends EventEmitter {
142
143
  this.emit('success', data, originalSettings, statusCode, responseTime);
143
144
  resolve(data);
144
145
  }
145
- // if (err) {
146
- // console.log("err11")
147
- // console.log(err)
148
- // console.log("err11")
149
- // reject(err);
150
- // } else {
151
- // resolve(data);
152
- // }
146
+ if (err) {
147
+ reject(err);
148
+ } else {
149
+ resolve(data);
150
+ }
153
151
  };
154
152
  this._request(settings)
155
153
  .then(response => {
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.16-axios-beta",
4
+ "version": "21.0.18-axios-beta",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "author": "HomeOffice",