diff options
Diffstat (limited to 'server/sonar-web/src/main/js/apps/code/app.js')
-rw-r--r-- | server/sonar-web/src/main/js/apps/code/app.js | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/server/sonar-web/src/main/js/apps/code/app.js b/server/sonar-web/src/main/js/apps/code/app.js index c16b4aa3057..ce973644f69 100644 --- a/server/sonar-web/src/main/js/apps/code/app.js +++ b/server/sonar-web/src/main/js/apps/code/app.js @@ -1,18 +1,33 @@ import React from 'react'; import { render } from 'react-dom'; import { Provider } from 'react-redux'; +import { Router, Route } from 'react-router'; +import { createHashHistory } from 'history'; +import { syncReduxAndRouter } from 'redux-simple-router'; import Code from './components/Code'; import configureStore from './store/configureStore'; const store = configureStore(); +const history = createHashHistory({ + queryKey: false +}); + +syncReduxAndRouter(history, store); + +window.sonarqube.appStarted.then(({ el, component }) => { + const CodeWithComponent = () => { + return <Code component={component}/>; + }; -window.sonarqube.appStarted.then(({ el, ...other }) => { render( <Provider store={store}> - <Code {...other}/> + <Router history={history}> + <Route path="/" component={CodeWithComponent}/> + <Route path="/:path" component={CodeWithComponent}/> + </Router> </Provider>, document.querySelector(el)); }); |