Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't get the result (response) by loginWith method #411

Closed
duxinxiao opened this issue Jul 17, 2019 · 5 comments · Fixed by #541
Closed

I can't get the result (response) by loginWith method #411

duxinxiao opened this issue Jul 17, 2019 · 5 comments · Fixed by #541

Comments

@duxinxiao
Copy link

duxinxiao commented Jul 17, 2019

What problem does this feature solve?

企业微信截图_a43ae1ff-6824-40bc-b543-a6001417fe9d.png
local schemes ignore the result except token, but sometimes we may need the hole response. For my situation, server will tell me some information about this login action, but I cant get it

What does the proposed changes look like?

return the whole response

This feature request is available on Nuxt community (#c375)
@ghost ghost added the cmty:feature-request label Jul 17, 2019
@woutercouvaras
Copy link

This would be great to have :) In the meantime, I'm still trying to figure out if there isn't a way around this to get the full response.

@duxinxiao
Copy link
Author

@woutercouvaras I create a custom strategy and copy local's code into it, then add a new line like "this.$auth.$storage.setState('xxxx', result)" after request. Just a work around

@woutercouvaras
Copy link

woutercouvaras commented Jul 19, 2019

Cool, I managed to get that to work. In my case, the token was one of the values returned, so I set my user to the total response and the token to result.token. Onward and upward. Thanks for sharing :)

@emielmolenaar
Copy link

emielmolenaar commented Nov 21, 2019

this.$auth.onError(function(error) {
  // error.response is your full server response, do something nice with it :)
})

See https://auth.nuxtjs.org/api/auth.html#onerror-handler.

@leviwheatcroft
Copy link

It's this then callback, it should return the original promise like:

      .then(() => {
        this.$storage.setState('busy', false)
        return promise
      })

I'd submit a PR, but I can't get the tests to pass (even before making any changes).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants