meteor - 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
})
解决方案
推荐阅读
- java - 什么是 Querydsl PathBuilder 字符串参数“变量”用于
- presto - BigQuery + Amazon Athena + Presto:对分区和列数的限制
- ruby-on-rails - 我如何在rails模型上使用ruby中的break
- docker - 如何使用 Google Cloud 从 Container Registry 部署 VM 映像
- python - “列表分配索引超出范围”错误如何修复?
- ios - 使用委托和协议(Swift)将数据传递回第一个视图控制器的问题
- apache-spark - Spark Streaming 重用物理计划
- python - 检查多个目录中是否存在文件夹
- javascript - 不明白如何更新 React 钩子
- html - 如何将文本与标题图像对齐?