Skip to content

Commit

Permalink
Add fallback navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
javalikescript committed May 16, 2024
1 parent 945fc2f commit 3f415d7
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions extensions/web-base/www/app/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ function getLocationPath() {
return formatNavigationPath('home');
}

app.$on('page-selected', function(id, path) {
function replaceLocationByNavigationPath(id, path) {
window.location.replace(window.location.pathname + '#' + formatNavigationPath(id, path));
});
}

app.$on('page-selected', replaceLocationByNavigationPath);

window.addEventListener('hashchange', function() {
app.navigateTo(getLocationPath());
Expand Down Expand Up @@ -85,7 +87,10 @@ window.addEventListener('hashchange', function() {
}));
}
}).then(function() {
app.navigateTo(getLocationPath());
if (!app.navigateTo(getLocationPath(), true)) {
replaceLocationByNavigationPath('home');
app.navigateTo(getLocationPath(), true);
}
function setupWebSocket() {
var protocol = location.protocol.replace('http', 'ws');
var url = protocol + '//' + location.host + '/ws/';
Expand Down

0 comments on commit 3f415d7

Please sign in to comment.