location
Read and manipulate the browser's window.location — current URL, pathname, query string, hash, redirects, and reloads.
Import: @rtorcato/browser-common/location
Example
import { getCurrentLocation, getPathname, redirectTo } from '@rtorcato/browser-common/location'
const url = getCurrentLocation()
if (getPathname() === '/login') {
redirectTo('/dashboard')
}
Exports
getCurrentLocation()— current URL (window.location.href), orundefinedoutside a browserredirectTo(url)— navigates to a new URLreloadPage()— reloads the current pagegetPathname()— current pathname, orundefinedoutside a browsergetSearch()— current query string, orundefinedoutside a browsergetHash()— current hash, orundefinedoutside a browser
See the API reference for full signatures.