Merge pull request #838 from djvaldez/fix-custom-basepath
Fix custom basepath in React components
This commit is contained in:
commit
c38f8a43c3
|
@ -12,7 +12,7 @@ export const INITIAL_SETUP_QUERY = gql`
|
|||
|
||||
export function login(token: string) {
|
||||
saveTokenCookie(token)
|
||||
window.location.href = '/'
|
||||
window.location.href = `${import.meta.env.BASE_URL}`
|
||||
}
|
||||
|
||||
export const Container = styled.div.attrs({ className: 'mt-20' })``
|
||||
|
|
|
@ -13,7 +13,10 @@ const placeholder =
|
|||
const getProtectedUrl = (url?: string) => {
|
||||
if (url == undefined) return undefined
|
||||
|
||||
const imgUrl = new URL(url, location.origin)
|
||||
const imgUrl = new URL(
|
||||
`${import.meta.env.BASE_URL}${url}`.replace(/\/\//g, '/'),
|
||||
location.origin
|
||||
)
|
||||
|
||||
const tokenRegex = location.pathname.match(/^\/share\/([\d\w]+)(\/?.*)$/)
|
||||
if (tokenRegex) {
|
||||
|
|
|
@ -16,7 +16,7 @@ setupLocalization()
|
|||
|
||||
const Main = () => (
|
||||
<ApolloProvider client={client}>
|
||||
<Router>
|
||||
<Router basename={import.meta.env.BASE_URL}>
|
||||
<SidebarProvider>
|
||||
<App />
|
||||
</SidebarProvider>
|
||||
|
|
Loading…
Reference in New Issue