Closed fede-rodes closed 6 years ago
It's a middleware function so should fetch from localStorage on each request:
https://github.com/apollographql/meteor-integration/blob/master/src/main-client.js#L73 https://github.com/apollographql/meteor-integration/blob/master/src/main-client.js#L127
Instead of setInterval
, could Tracker.autorun
on Meteor.userId()
Hi @lorensr thanks for the quick reply and for the suggestion :)
I removed Tracker and reactive-vars from my project, I'm trying to rely as little as possible on Meteor from the front-end. I'll try to listen to localStore changes coming from the same tab, maybe in that way I can trigger a refetch more naturally; otherwise I'll probably go back to tracker!
Cheers and keep the great work!
Oh, have you tried this? 😄
http://docs.meteor.com/api/accounts-multi.html#AccountsCommon-onLogin
On Wed, Nov 15, 2017 at 7:49 AM, Federico Rodes notifications@github.com wrote:
Closed #113 https://github.com/apollographql/meteor-integration/issues/113.
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/apollographql/meteor-integration/issues/113#event-1342924802, or mute the thread https://github.com/notifications/unsubscribe-auth/AAPVmNErTJ8FLPT1UUe5wN6YS8dfvlJDks5s2t3cgaJpZM4QeJb4 .
@lorensr just saw your comment, sorry!
I'll take a look, many thanks and I'll let you know if it woks :)
haha the simplest solution always works :) Thanks
Hi guys,
I'm using facebook-accounts along with this package and have the following issue. When the user logs in with facebook using loginStyle = 'redirect', the loginTokens take some milliseconds to be set on localStorage which produces that the user stays 'logged out' after response comes back from facebook. Of course, if I refresh the page, the tokens are read correctly and the user is then authenticated. At the moment I've solved the issue by setting up a Meteor.setInterval that fires a refetch call after 500 miliseconds. Is this a bug from the package? Do you have a better solution to solve the issue?
This is the patch I use to solve the issue:
And here is my Apollo-Client config:
Here's the repo I'm working on: https://github.com/fede-rodes/meteor-apollo-starter-kit
Any help will be really appreciated :)