@@ -128,10 +128,11 @@ export default class Auth {
128128 return Promise . resolve ( )
129129 }
130130
131- return this . wrapLogin ( this . strategy . login ( ...arguments ) ) . catch ( error => {
132- this . callOnError ( error , { method : 'login' } )
133- return Promise . reject ( error )
134- } )
131+ return this . wrapLogin ( this . strategy . login ( ...arguments ) )
132+ . catch ( error => {
133+ this . callOnError ( error , { method : 'login' } )
134+ return Promise . reject ( error )
135+ } )
135136 }
136137
137138 fetchUser ( ) {
@@ -259,7 +260,7 @@ export default class Auth {
259260 return this . $storage . getState ( 'busy' )
260261 }
261262
262- request ( endpoint , defaults ) {
263+ request ( endpoint , defaults , withResponse ) {
263264 const _endpoint =
264265 typeof defaults === 'object'
265266 ? Object . assign ( { } , defaults , endpoint )
@@ -274,10 +275,15 @@ export default class Auth {
274275 return this . ctx . app . $axios
275276 . request ( _endpoint )
276277 . then ( response => {
277- if ( _endpoint . propertyName ) {
278- return getProp ( response . data , _endpoint . propertyName )
278+ const result = _endpoint . propertyName ? getProp ( response . data , _endpoint . propertyName ) : response . data
279+
280+ if ( withResponse ) {
281+ return {
282+ response,
283+ result
284+ }
279285 } else {
280- return response . data
286+ return result
281287 }
282288 } )
283289 . catch ( error => {
@@ -310,8 +316,9 @@ export default class Auth {
310316 this . error = null
311317
312318 return Promise . resolve ( promise )
313- . then ( ( ) => {
319+ . then ( response => {
314320 this . $storage . setState ( 'busy' , false )
321+ return response
315322 } )
316323 . catch ( error => {
317324 this . $storage . setState ( 'busy' , false )
0 commit comments