Aurelia取消导航策略中的导航

时间:2017-02-27 15:33:48

标签: aurelia aurelia-router

我有一个登录路由,将用户重定向到外部Open ID Connect登录页面。在那里,如果用户点击后退按钮,他们会点击重定向它们的相同路线,从而再次被重定向。有没有办法取消Aurelia的导航或阻止当前路线在历史记忆中被记住?

       config.mapRoute({
            name: "login",
            nav: false,

            // If I exclude the module id, I get the desired behavior but errors are thrown from Aurelia.
            moduleId: "components/login/login",

            route: "login",
            navigationStrategy: (instruction: NavigationInstruction) => {

                // This promise constructs the redirect url then sets the window.location.href.
                // Unfortunately, Aurelia seems to be finishing its business before the page is redirected because this login route is recorded in history.
                return this.userManager.signinRedirect();

            }
        });

1 个答案:

答案 0 :(得分:0)

我知道它已经有一段时间了,所以你可能在其他地方找到了答案,但你可以试试

router.navigate('new url', { replace: true });