1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge pull request #4586 from thornbill/fix-can-go-back

Add path checking for canGoBack
This commit is contained in:
Bill Thornton 2023-05-10 14:06:19 -04:00 committed by GitHub
commit 98b8b07f02
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -17,6 +17,7 @@ export const history = createHashHistory();
* Page types of "no return" (when "Go back" should behave differently, probably quitting the application). * 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_TYPES = ['home', 'login', 'selectserver'];
const START_PAGE_PATHS = ['/home.html', '/login.html', '/selectserver.html'];
class AppRouter { class AppRouter {
allRoutes = new Map(); allRoutes = new Map();
@ -165,12 +166,13 @@ class AppRouter {
} }
canGoBack() { canGoBack() {
const curr = this.currentRouteInfo?.route; const { path, route } = this.currentRouteInfo;
if (!curr) {
if (!route) {
return false; 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; return false;
} }