Is there any method to get the URL without query string?
location.toString().replace(location.search, "")
Try this:
let path = window.location.href.split('?')[0]
console.log({path})
Read about Window.location
and the Location
interface:
const urlPieces = [location.protocol, '//', location.host, location.pathname]
let url = urlPieces.join('')
console.log({urlPieces, url})