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

account.signOut while offline #161

Open
amallo opened this issue Oct 17, 2017 · 7 comments
Open

account.signOut while offline #161

amallo opened this issue Oct 17, 2017 · 7 comments

Comments

@amallo
Copy link

amallo commented Oct 17, 2017

Hi,

First of all I don't know if considered as an issue, you should tell me.

I am working on an offline electron's app and Hoodie seems to be great for that but

account.signOut
seems to be rejected with this error

{"status":0,"name":"unknown","message":"getCheckpoint rejected with "} while offline,

that sounds wierd to have to be connected to sign out, I am missing something ?

account.signOut works great when server is up

Here is me logout method ignoreLocalChanges param changes nothing

logout: () => {
    return hoodie.account.signOut({ignoreLocalChanges: true})
}

package.json

"@hoodie/client": "^10.1.1",
"pouchdb-browser": "^6.3.4",
@gr2m
Copy link
Member

gr2m commented Oct 18, 2017

I’m sorry I didn’t get to it today. Long day was long ... I did not forget about it, I’ll try again tomorrow. Maybe someone else will be able to help out quicker

@amallo
Copy link
Author

amallo commented Oct 18, 2017

Of course no problem ! I hope you'll find something

Here is my Hoodie initialisation

import Hoodie from '@hoodie/client'
import PouchDB from 'pouchdb-browser'
const hoodie = new Hoodie({
  url: 'http://localhost:8080',
  PouchDB
})

@gr2m
Copy link
Member

gr2m commented Oct 18, 2017

thanks a lot, I was able to reproduce the issue 👍 I’ll investigate.
Would you be interested in contributing a fix? I’d help you out to find your way around and also help to figure out the bug and the fix, but always happy to onboard new contributors and empower folks to help themselves in future :)

@amallo
Copy link
Author

amallo commented Oct 19, 2017

Nice ! Sure I can try to help to contribute hope I will find my path :)

@gr2m
Copy link
Member

gr2m commented Oct 19, 2017

great :) I need to give this some thought first but I’ll get back to you next week.

To give you some background already: we have split up Hoodie into many smaller modules, mostly to force us to create self-contained modules with good APIs, documentation, tests but above all to make contribution easier. So now we have logic for hoodie.account in this repository while we have logic for hoodie.store in the hoodie-store-client repository.

The challenge is now that hoodie.account.signOut() should behave differently based on wether there are local changes in the store or not, so that check would need to go into the hoodie-client repository which combines the two :D In order to make that work for hoodie-client we need ways to "hook" into the signout process from outside the hoodie-account-client, we already have that: https://github.com/hoodiehq/hoodie-account-client#hooks

So now we need to put it all together, I’ll figure this out and then walk you through it. Here is some more info on the overall Hoodie architecture if you are interested: http://docs.hood.ie/en/latest/about/architecture.html

@gr2m
Copy link
Member

gr2m commented Nov 5, 2017

I’m sorry I didn’t get back to you yet. I’m heads down with work and preparing http://offlinefirst.org/camp/, but I will get back to you after the event, I promise

@gr2m
Copy link
Member

gr2m commented Jan 23, 2018

I’m so sorry I didn’t get back to you as promised, things went rollercoster last year :( is this still relevant to you?

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

No branches or pull requests

2 participants