mirror of
https://github.com/aljazceru/pear-docs.git
synced 2025-12-17 14:34:19 +01:00
Fix router (#39)
* on click, do not add route if included in pathname * corrected readme tools table links * remove code blocks inside links * corrected hypercore and hyperwarm links --------- Co-authored-by: rafapaezbas <rafa@holepunch.com>
This commit is contained in:
@@ -30,7 +30,11 @@ customElements.define('app-router', class AppRouter extends HTMLElement {
|
||||
if (evt.target.origin !== location.origin) return window.open(evt.target.href)
|
||||
const { tagName } = evt.target.getRootNode().host || {}
|
||||
const route = tagName ? this.getAttribute(tagName) : ''
|
||||
this.load(route + evt.target.pathname).catch(console.error)
|
||||
if (evt.target.pathname.startsWith(route)) {
|
||||
this.load(evt.target.pathname).catch(console.error)
|
||||
} else {
|
||||
this.load(route + evt.target.pathname).catch(console.error)
|
||||
}
|
||||
}
|
||||
|
||||
connectedCallback () {
|
||||
|
||||
Reference in New Issue
Block a user