@@ -86,9 +86,10 @@ export class BaasClient {
86
86
}
87
87
88
88
_do ( resource , method , options ) {
89
- options = options || { } ;
90
- options . refreshOnFailure = options . refreshOnFailure || true ;
91
- options . useRefreshToken = options . useRefreshToken || false ;
89
+ options = Object . assign ( { } , {
90
+ refreshOnFailure : true ,
91
+ useRefreshToken : false
92
+ } , options ) ;
92
93
93
94
if ( ! options . noAuth ) {
94
95
if ( this . auth ( ) === null ) {
@@ -152,19 +153,16 @@ export class BaasClient {
152
153
if ( this . authManager . isImpersonatingUser ( ) ) {
153
154
return this . authManager . refreshImpersonation ( this ) ;
154
155
}
155
- return this . _do ( '/auth/newAccessToken' , 'POST' , { refreshOnFailure : false , useRefreshToken : true } ) . then ( ( response ) => {
156
- return response . json ( ) . then ( json => {
157
- this . authManager . setAccessToken ( json . accessToken ) ;
158
- return Promise . resolve ( ) ;
159
- } ) ;
160
- } ) ;
156
+
157
+ return this . _do ( '/auth/newAccessToken' , 'POST' , { refreshOnFailure : false , useRefreshToken : true } )
158
+ . then ( response => response . json ( ) )
159
+ . then ( json => this . authManager . setAccessToken ( json . accessToken ) ) ;
161
160
}
162
161
163
- executePipeline ( stages , options ) {
162
+ executePipeline ( stages , options = { } ) {
164
163
let responseDecoder = ( d ) => EJSON . parse ( d , { strict : false } ) ;
165
164
let responseEncoder = ( d ) => EJSON . stringify ( d ) ;
166
165
167
- options = options || { } ;
168
166
if ( options . decoder ) {
169
167
if ( ( typeof options . decoder ) !== 'function' ) {
170
168
throw new Error ( 'decoder option must be a function, but "' + typeof ( options . decoder ) + '" was provided' ) ;
0 commit comments