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) {
|
export function login(token: string) {
|
||||||
saveTokenCookie(token)
|
saveTokenCookie(token)
|
||||||
window.location.href = '/'
|
window.location.href = `${import.meta.env.BASE_URL}`
|
||||||
}
|
}
|
||||||
|
|
||||||
export const Container = styled.div.attrs({ className: 'mt-20' })``
|
export const Container = styled.div.attrs({ className: 'mt-20' })``
|
||||||
|
|
|
@ -13,7 +13,10 @@ const placeholder =
|
||||||
const getProtectedUrl = (url?: string) => {
|
const getProtectedUrl = (url?: string) => {
|
||||||
if (url == undefined) return undefined
|
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]+)(\/?.*)$/)
|
const tokenRegex = location.pathname.match(/^\/share\/([\d\w]+)(\/?.*)$/)
|
||||||
if (tokenRegex) {
|
if (tokenRegex) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ setupLocalization()
|
||||||
|
|
||||||
const Main = () => (
|
const Main = () => (
|
||||||
<ApolloProvider client={client}>
|
<ApolloProvider client={client}>
|
||||||
<Router>
|
<Router basename={import.meta.env.BASE_URL}>
|
||||||
<SidebarProvider>
|
<SidebarProvider>
|
||||||
<App />
|
<App />
|
||||||
</SidebarProvider>
|
</SidebarProvider>
|
||||||
|
|
Loading…
Reference in New Issue