hoodiehq / hoodie-client

:dog: Client API for the Hoodie server
Apache License 2.0
34 stars 25 forks source link

error:unauthenticated is not triggered while using the app #27

Open boennemann opened 8 years ago

boennemann commented 8 years ago

via @rogeriochaves https://github.com/hoodiehq/hoodie-server/issues/413


Hello,

So, I create a new instance of hoodie (new Hoodie('HOODIE_URL')) when the page is loaded, and I listen to error:unauthenticated events, but apparently this event is only triggered when the session is expired and the user reloads the page.

I put my couchdb session to expire in 15s just to test, and when the user is using the app, after 15s, the data syncing starts to throw 401s, and the user can't logout, but no error:unauthenticated is triggered, only if I reload the page.

Thanks!

gr2m commented 8 years ago

As soon as we have the new account & store modules glued together in hoodie-client, I'd suggest we make an integration tests to assure that hoodie.on("account:error:unauthenticated", handler) gets triggered when hoodie.on("store:error:unauthenticated", handler) gets triggered, to prevent this from happening in future