首页 > 解决方案 > FlowRouter not redirecting calling its action in onLogout

问题描述

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
})

标签: meteormeteor-accountsflow-router

解决方案


推荐阅读