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

include profile in signIn / signOut / fetch response #107

Open
gr2m opened this issue Jul 20, 2016 · 1 comment · May be fixed by #112
Open

include profile in signIn / signOut / fetch response #107

gr2m opened this issue Jul 20, 2016 · 1 comment · May be fixed by #112

Comments

@gr2m
Copy link
Member

gr2m commented Jul 20, 2016

If I want to get my profile data I have to do two calls

hoodie.account.signIn({username: 'foo', password: 'bar'})
.then(function () {
  return hoodie.account.profile.fetch()
})
.then(function () {
  // hoodie.account.profile.get() now returns locally cached profile data
})

Our JSON API supports the ?include parameter for all requests, so we could do two things

I would suggest to include option to signIn / signOut methods (we already do this for some of the admin API methods). The fetch method would need to send the ?include=account.profile param if it was called with something like account.fetch('profile.settings')

With that change all profile properties would be cached offline after signIn, so we can do hoodie.account.profile.get() later any time, even without an internet connection.

hoodie.account.signIn({username: 'foo', password: 'bar', include: 'profile'})
.then(function () {
  // hoodie.account.profile.get() now returns locally cached profile data
})
@gr2m
Copy link
Member Author

gr2m commented Jul 25, 2016

As suggested in #111 I rather tend to always include the .profile property in all the things for sake of simplicity.

@gr2m gr2m linked a pull request Jul 25, 2016 that will close this issue
3 tasks
@gr2m gr2m self-assigned this Jul 25, 2016
@gr2m gr2m removed their assignment Sep 28, 2019
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.

1 participant