@@ -8,6 +8,9 @@ var $wot = require('../../configs/wot');
8
8
9
9
10
10
module . exports = function ( $db ) {
11
+ const host = $rest . host + ':' + $rest . port
12
+ const oauthHost = $oauth . host + ':' + $oauth . port
13
+
11
14
var users = $db . users ;
12
15
13
16
var signUp = function ( req , res , next ) {
@@ -36,7 +39,7 @@ module.exports = function ($db) {
36
39
. set ( 'Cache-Control' , 'no-cache' )
37
40
. set ( 'Content-Type' , 'application/json' )
38
41
. send ( data )
39
- . end ( function ( err , res ) {
42
+ . end ( function ( err , res = { } ) {
40
43
return res . ok ? resolve ( res . body ) : reject ( err . response . body . error ) ;
41
44
} ) ;
42
45
} ) ;
@@ -77,7 +80,7 @@ module.exports = function ($db) {
77
80
. set ( 'Content-Type' , 'application/x-www-form-urlencoded' )
78
81
. send ( data )
79
82
. set ( 'Authorization' , 'Basic ' + req . basicToken )
80
- . end ( function ( err , res ) {
83
+ . end ( function ( err , res = { } ) {
81
84
var errMsg ;
82
85
if ( err ) {
83
86
if ( err . response . body . error_description . code === 401 ) {
@@ -163,7 +166,7 @@ module.exports = function ($db) {
163
166
. set ( 'Content-Type' , 'application/x-www-form-urlencoded' )
164
167
. send ( data )
165
168
. set ( 'Authorization' , 'Basic ' + req . basicToken )
166
- . end ( function ( err , res ) {
169
+ . end ( function ( err , res = { } ) {
167
170
return res . ok ? resolve ( res . body ) : reject ( err . response . body . message ) ;
168
171
} ) ;
169
172
} ) ;
@@ -176,7 +179,7 @@ module.exports = function ($db) {
176
179
. set ( 'Cache-Control' , 'no-cache' )
177
180
. set ( 'Content-Type' , 'application/x-www-form-urlencoded' )
178
181
. set ( 'Authorization' , 'Bearer ' + token . access_token )
179
- . end ( function ( err , res ) {
182
+ . end ( function ( err , res = { } ) {
180
183
if ( res . ok ) {
181
184
info . access_token = token . access_token ;
182
185
info . expire_time = token . expire_time ;
@@ -240,7 +243,7 @@ module.exports = function ($db) {
240
243
. set ( 'Cache-Control' , 'no-cache' )
241
244
. set ( 'Content-Type' , 'application/x-www-form-urlencoded' )
242
245
. set ( 'Authorization' , 'Bearer ' + token . access_token )
243
- . end ( function ( err , res ) {
246
+ . end ( function ( err , res = { } ) {
244
247
return res . ok ? resolve ( 'active' ) : reject ( {
245
248
code : err . response . body . code ,
246
249
message : err . response . body . message ,
@@ -266,7 +269,7 @@ module.exports = function ($db) {
266
269
. set ( 'Content-Type' , 'application/x-www-form-urlencoded' )
267
270
. send ( data )
268
271
. set ( 'Authorization' , 'Basic ' + req . basic_token )
269
- . end ( function ( err , res ) {
272
+ . end ( function ( err , res = { } ) {
270
273
return res . ok ? resolve ( res . body ) : reject ( err . response . body . message ) ;
271
274
} ) ;
272
275
} ) ;
0 commit comments