From ca20f8f8f1811ff24bd331f714ef5ac86a9822f5 Mon Sep 17 00:00:00 2001 From: Diego Sampaio Date: Tue, 5 Oct 2021 18:57:03 -0300 Subject: [PATCH] [FIX] resumeToken not working (#23379) --- client/startup/loginViaQuery.ts | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/client/startup/loginViaQuery.ts b/client/startup/loginViaQuery.ts index 485dda8fb2a8..5c7fcbf8e7d5 100644 --- a/client/startup/loginViaQuery.ts +++ b/client/startup/loginViaQuery.ts @@ -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'); + }); }); });