2017-02-27 83 views
1

我有一條登錄路線,將用戶重定向到外部Open ID Connect登錄頁面。一旦到達那裏,如果用戶點擊後退按鈕,他們會按照重定向他們的相同路線重新定向。有沒有辦法取消Aurelia的導航或阻止當前路線在歷史中被記住?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(); 

      } 
     }); 

回答

0

我知道它已經有一段時間,所以你可能找到了答案其他地方,但你可以嘗試

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