Fall back to useRouterHistory method.
parent
7562409fcd
commit
b2738b51e2
|
@ -1,8 +1,8 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import {render} from 'react-dom'
|
import {render} from 'react-dom'
|
||||||
import {Provider} from 'react-redux'
|
import {Provider} from 'react-redux'
|
||||||
import {Router, Route} from 'react-router'
|
import {Router, Route, useRouterHistory} from 'react-router'
|
||||||
import {createHistory, useBasename} from 'history'
|
import {createHistory} from 'history'
|
||||||
import {syncHistoryWithStore} from 'react-router-redux'
|
import {syncHistoryWithStore} from 'react-router-redux'
|
||||||
|
|
||||||
import App from 'src/App'
|
import App from 'src/App'
|
||||||
|
@ -42,11 +42,18 @@ import {HEARTBEAT_INTERVAL} from 'shared/constants'
|
||||||
|
|
||||||
const rootNode = document.getElementById('react-root')
|
const rootNode = document.getElementById('react-root')
|
||||||
|
|
||||||
|
let browserHistory
|
||||||
const basepath = rootNode.dataset.basepath || ''
|
const basepath = rootNode.dataset.basepath || ''
|
||||||
window.basepath = basepath
|
window.basepath = basepath
|
||||||
const browserHistory = useBasename(createHistory)({
|
if (basepath) {
|
||||||
basename: basepath, // basepath is written in when available by the URL prefixer middleware
|
browserHistory = useRouterHistory(createHistory)({
|
||||||
})
|
basename: basepath, // this is written in when available by the URL prefixer middleware
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
browserHistory = useRouterHistory(createHistory)({
|
||||||
|
basename: '',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const store = configureStore(loadLocalStorage(), browserHistory)
|
const store = configureStore(loadLocalStorage(), browserHistory)
|
||||||
const {dispatch} = store
|
const {dispatch} = store
|
||||||
|
|
Loading…
Reference in New Issue