@@ -86,9 +86,10 @@ export class BaasClient {
8686 }
8787
8888 _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 ) ;
9293
9394 if ( ! options . noAuth ) {
9495 if ( this . auth ( ) === null ) {
@@ -152,19 +153,16 @@ export class BaasClient {
152153 if ( this . authManager . isImpersonatingUser ( ) ) {
153154 return this . authManager . refreshImpersonation ( this ) ;
154155 }
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 ) ) ;
161160 }
162161
163- executePipeline ( stages , options ) {
162+ executePipeline ( stages , options = { } ) {
164163 let responseDecoder = ( d ) => EJSON . parse ( d , { strict : false } ) ;
165164 let responseEncoder = ( d ) => EJSON . stringify ( d ) ;
166165
167- options = options || { } ;
168166 if ( options . decoder ) {
169167 if ( ( typeof options . decoder ) !== 'function' ) {
170168 throw new Error ( 'decoder option must be a function, but "' + typeof ( options . decoder ) + '" was provided' ) ;
0 commit comments