fix: navbar links

This commit is contained in:
AdrienLSH 2024-01-15 13:50:03 +01:00
parent fa97abb825
commit 359d78e4d8

View File

@ -125,7 +125,7 @@ const router = async(uri) => {
window.addEventListener("popstate", function() {router(location.pathname)}); window.addEventListener("popstate", function() {router(location.pathname)});
document.addEventListener("DOMContentLoaded", () => { document.addEventListener("DOMContentLoaded", async () => {
document.body.addEventListener("click", e => { document.body.addEventListener("click", e => {
if (e.target.matches("[data-link]")) { if (e.target.matches("[data-link]")) {
e.preventDefault(); e.preventDefault();
@ -136,6 +136,7 @@ document.addEventListener("DOMContentLoaded", () => {
navigateTo(e.target.href.slice(location.origin.length)); navigateTo(e.target.href.slice(location.origin.length));
} }
}); });
await client.isAuthentificate();
router(location.pathname); router(location.pathname);
document.querySelector('a[href=\'' + location.pathname + '\']')?.classList.add('active'); document.querySelector('a[href=\'' + location.pathname + '\']')?.classList.add('active');
}); });