Factor out getting basepath to utils fn
Co-authored-by Jared Scheib <jared.scheib@gmail.com> Co-authored-by Brandon Farmer <bthesorceror@gmail.com>pull/3144/head
parent
1e4c212f39
commit
4276e9c4bd
|
@ -12,6 +12,7 @@ import configureStore from 'src/store/configureStore'
|
|||
import {loadLocalStorage} from 'src/localStorage'
|
||||
|
||||
import {getRootNode} from 'src/utils/nodes'
|
||||
import {getBasepath} from 'src/utils/basepath'
|
||||
|
||||
import App from 'src/App'
|
||||
import {
|
||||
|
@ -52,6 +53,8 @@ const errorsQueue = []
|
|||
|
||||
const rootNode = getRootNode()
|
||||
|
||||
const basepath = getBasepath()
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
basepath: string
|
||||
|
@ -59,7 +62,6 @@ declare global {
|
|||
}
|
||||
|
||||
// Older method used for pre-IE 11 compatibility
|
||||
const basepath = rootNode.getAttribute('data-basepath') || ''
|
||||
window.basepath = basepath
|
||||
|
||||
const browserHistory = useRouterHistory(createHistory)({
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
import {getRootNode} from 'src/utils/nodes'
|
||||
|
||||
export const getBasepath = () => {
|
||||
const rootNode = getRootNode()
|
||||
return rootNode.getAttribute('data-basepath') || ''
|
||||
}
|
Loading…
Reference in New Issue