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:
commit
98b8b07f02
1 changed files with 5 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue