Commit 445480d8 authored by Clément's avatar Clément

update: updateSubRouter on DOMContentLoaded

parent 83929a21
Pipeline #2632 passed with stage
in 27 seconds
......@@ -6,9 +6,7 @@ export default class SIBRoute extends HTMLElement {
this.addEventListener('click', event => this.router.navigate(this.name));
// Resetting all routers within the selected view
Promise.resolve().then(() => {
this.updateSubRouters();
});
document.addEventListener('DOMContentLoaded', () => this.updateSubRouters());
}
get name() {
......
......@@ -66,9 +66,10 @@ export default class SIBRouter extends HTMLElement {
}
const id = resource ? resource['@id'] : null;
const path = route.getPath(this.prefix, routeName, id);
//update current URL
this.display(routeName, resource);
if(this.hasAttribute('keep-url')) return;
//update current URL
const prefix = this.useHash ? '#' : '/';
history.pushState({}, routeName, prefix + path);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment