feat: home page hash-based tab routing for shareable links
This commit is contained in:
@@ -55,7 +55,8 @@ const App = {
|
||||
}
|
||||
|
||||
if (page === 'install') { this.showPublic('install'); return; }
|
||||
if (page === 'home' || page === 'login' || page === 'register') { this.showPublic(page); return; }
|
||||
if (page === 'home') { this.showPublic('home', param); return; }
|
||||
if (page === 'login' || page === 'register') { this.showPublic(page); return; }
|
||||
if (!Auth.logged()) { location.hash = '#/login'; return; }
|
||||
|
||||
this.showLayout();
|
||||
@@ -83,13 +84,13 @@ const App = {
|
||||
}
|
||||
},
|
||||
|
||||
showPublic(page) {
|
||||
showPublic(page, param) {
|
||||
document.getElementById('top-auth').classList.remove('hidden');
|
||||
document.getElementById('main-layout').classList.add('hidden');
|
||||
const pub = document.getElementById('public-page');
|
||||
pub.classList.remove('hidden');
|
||||
const comp = page === 'login' ? LoginPage : page === 'register' ? RegisterPage : page === 'install' ? InstallPage : HomePage;
|
||||
Promise.resolve(comp.render()).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(); });
|
||||
Promise.resolve(comp.render(param)).then(html => { pub.innerHTML = html; if (comp.mount) comp.mount(param); });
|
||||
},
|
||||
|
||||
showLayout() {
|
||||
|
||||
Reference in New Issue
Block a user