gpt4 book ai didi

meteor - 如何在 Iron Router blaze 集成上正确地用 pause() 替换 this.stop()

转载 作者:行者123 更新时间:2023-12-04 06:19:11 25 4
gpt4 key购买 nike

当我将 Iron Router 升级到 blaze 集成分支时,我开始收到此警告:

"You called this.stop() inside a hook or your action function but you should use pause() now instead" 

Chrome 控制台 --> iron-router.js:2104 --> 包中的 client/route_controller.js:193

代码在客户端:
Router.before(mustBeSignedIn, {except: ['userSignin', 'userSignup', 'home']});

var mustBeSignedIn = function () {
if (!Meteor.user()) {
// render the home template
this.redirect('home');
// stop the rest of the before hooks and the action function
this.stop();
return false;
}
return true;
}

我尝试更换 this.stop()与: pause() , Router.pause()this.pause()但仍然不起作用。另外我还没有在铁路由器包上找到暂停功能。

如何正确更换 this.stop()pause() ?

谢谢

最佳答案

我开了一个 issue在 Github 上关于这个。这是我得到的回应:

Oops I may have not changed the redirect method yet. Just use Router.go as it will work fine now. I will change over this.redirect sometime next week or a PR is welcome. Controllers are now automatically stopped if you change routes in a hook. You can pause the current run by calling the pause method which is passed as a parameter to your hooks and action functions.

关于meteor - 如何在 Iron Router blaze 集成上正确地用 pause() 替换 this.stop(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22114572/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com