0

On the client side, when I implement Accounts.onLogout I say that it should redirect to the root directory using FlowRouter.go('root'); and also tried with FlowRouter.go('/');. However it seems that it doesn't redirect properly.

Curiously, if I use a timeout (something I don't like) it works, and if I redirect to root and then do a FlowRouter.reload(); it doesn't change the address bar (actually it changes to root and quickly changes to where it was).

Is the user still logged in when onLogout is called?

What would be the best approach?

Accounts.onLogout(() => {
        // setTimeout(() => {FlowRouter.go('/');}, 3000); this way works
        FlowRouter.go('/'); // this way changes the address bar but doesn't rerender.
        // FlowRouter.reload(); adding this, keeps the address bar where it was, in my case in /panel
})
4
  • Maybe there is a trigger on a route interfering with the redirect? Commented Dec 21, 2019 at 23:47
  • What kind of trigger? How do I check it? Commented Dec 21, 2019 at 23:47
  • See github.com/kadirahq/flow-router/blob/master/README.md#triggers Commented Dec 21, 2019 at 23:49
  • @Jankapunkt I'm not using any trigger. Actually, right now my router is so simple that it has only two routes. One for logged in users, and another one for non-logged in users. Commented Dec 22, 2019 at 14:16

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.