Skip to content

Commit

Permalink
[FIX] resumeToken not working (#23379)
Browse files Browse the repository at this point in the history
  • Loading branch information
sampaiodiego committed Oct 6, 2021
1 parent 3ef1a45 commit ca20f8f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions client/startup/loginViaQuery.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
import { FlowRouter } from 'meteor/kadira:flow-router';
import { Meteor } from 'meteor/meteor';
import { Tracker } from 'meteor/tracker';

Meteor.startup(() => {
const resumeToken = FlowRouter.getQueryParam('resumeToken');
if (!resumeToken) {
return;
}

Meteor.loginWithToken(resumeToken, () => {
if (FlowRouter.getRouteName()) {
FlowRouter.setQueryParams({ resumeToken: null, userId: null });
Tracker.afterFlush(() => {
const resumeToken = FlowRouter.getQueryParam('resumeToken');
if (!resumeToken) {
return;
}
FlowRouter.go('/home');

Meteor.loginWithToken(resumeToken, () => {
if (FlowRouter.getRouteName()) {
FlowRouter.setQueryParams({ resumeToken: null, userId: null });
return;
}
FlowRouter.go('/home');
});
});
});

0 comments on commit ca20f8f

Please sign in to comment.