Skip to content

Commit

Permalink
fixed hash router without a hash
Browse files Browse the repository at this point in the history
  • Loading branch information
silkroadnomad committed Mar 28, 2024
1 parent 3ec6b28 commit ef98b06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/router.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ import { browser } from '$app/environment';
function getHash () {
if(browser){
const hashWithDID = location.hash.replace(/^#/, '')
if(hashWithDID.length===1) return ""
if(hashWithDID.length<2) return ""
return hashWithDID.indexOf('/',1)!==-1?hashWithDID.substring(0,hashWithDID.indexOf('/',1)):hashWithDID
}
}

function getDID () {
if(browser){
const hashWithDID = location.hash.replace(/^#/, '')
if(hashWithDID.length===1) return ""
if(hashWithDID.length<2) return ""
return hashWithDID.split("/")[2].substring(0,hashWithDID.split("/")[2].indexOf("?"))
}
}
Expand Down

0 comments on commit ef98b06

Please sign in to comment.