basepath config as singleton
This commit is contained in:
10
src/routing/basePath.js
Normal file
10
src/routing/basePath.js
Normal file
@ -0,0 +1,10 @@
|
||||
const base = document.querySelector('base');
|
||||
|
||||
let basePath;
|
||||
if (base && base.href) {
|
||||
basePath = base.attributes.getNamedItem('href').value;
|
||||
} else {
|
||||
basePath = '';
|
||||
}
|
||||
|
||||
export default basePath;
|
@ -1,10 +1,10 @@
|
||||
import { createHistory } from 'history';
|
||||
import { useRouterHistory } from 'react-router';
|
||||
import { syncHistoryWithStore } from 'react-router-redux';
|
||||
import basePath from './basePath';
|
||||
|
||||
const base = document.querySelector('base');
|
||||
let history = useRouterHistory(createHistory)({
|
||||
basename: base && base.href || ''
|
||||
basename: basePath
|
||||
});
|
||||
|
||||
const syncHistory = (store) => {
|
||||
|
Reference in New Issue
Block a user