...
 
Commits (2)
...@@ -38,13 +38,13 @@ export default class SIBRouter extends HTMLElement { ...@@ -38,13 +38,13 @@ export default class SIBRouter extends HTMLElement {
return this.querySelectorAll('sib-route'); return this.querySelectorAll('sib-route');
} }
display(routeName = this.currentRouteName, resource, keepURL=false) { display(routeName = this.currentRouteName, keepURL=false) {
for (let route of this.routes) { for (let route of this.routes) {
if (routeName === route.name) { if (routeName === route.name) {
route.activate(keepURL); route.activate(keepURL);
this.dispatchEvent( this.dispatchEvent(
new CustomEvent('navigate', { new CustomEvent('navigate', {
detail: { route: routeName, resource }, detail: { route: routeName, resource: {id: route.resourceId} },
}), }),
); );
} else { } else {
...@@ -82,7 +82,7 @@ export default class SIBRouter extends HTMLElement { ...@@ -82,7 +82,7 @@ export default class SIBRouter extends HTMLElement {
const prefix = this.useHash ? '#' : '/'; const prefix = this.useHash ? '#' : '/';
history.pushState({}, routeName, prefix + path); history.pushState({}, routeName, prefix + path);
} }
this.display(routeName, resource, keepURL); this.display(routeName, keepURL);
} }
} }
customElements.define('sib-router', SIBRouter); customElements.define('sib-router', SIBRouter);
......