Fix bug that pathname is always empty (#859)

This commit is contained in:
Erik Michelson 2020-12-17 23:30:18 +01:00 committed by GitHub
parent 0c0841639a
commit c5ad0e6eca
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -8,6 +8,8 @@ import { useLocation } from 'react-router'
export const useFrontendBaseUrl = (): string => {
const { pathname } = useLocation()
const location = window.location
const cleanedPathName = location.pathname.replace(pathname, '')
return window.location.pathname.replace(pathname, '')
return `${location.protocol}//${location.host}${cleanedPathName}`
}