Skip to content

include profile in signIn / signOut / fetch response #107

@gr2m

Description

@gr2m

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
})

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions