From 57e441d3ce01a33e5995a7797eaba0d7b151d040 Mon Sep 17 00:00:00 2001 From: Bill Thornton Date: Wed, 10 May 2023 09:50:30 -0400 Subject: [PATCH] Add path checking for canGoBack --- src/components/router/appRouter.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/components/router/appRouter.js b/src/components/router/appRouter.js index 72102393c4..7c0d8e86c1 100644 --- a/src/components/router/appRouter.js +++ b/src/components/router/appRouter.js @@ -17,6 +17,7 @@ export const history = createHashHistory(); * Page types of "no return" (when "Go back" should behave differently, probably quitting the application). */ const START_PAGE_TYPES = ['home', 'login', 'selectserver']; +const START_PAGE_PATHS = ['/home.html', '/login.html', '/selectserver.html']; class AppRouter { allRoutes = new Map(); @@ -165,12 +166,13 @@ class AppRouter { } canGoBack() { - const curr = this.currentRouteInfo?.route; - if (!curr) { + const { path, route } = this.currentRouteInfo; + + if (!route) { return false; } - if (!document.querySelector('.dialogContainer') && START_PAGE_TYPES.includes(curr.type)) { + if (!document.querySelector('.dialogContainer') && (START_PAGE_TYPES.includes(route.type) || START_PAGE_PATHS.includes(path))) { return false; }