Try to fix standalone routing

This commit is contained in:
Erik Ziegler 2019-01-17 17:39:08 +01:00
parent 2082d46a57
commit 59b7c951df
10 changed files with 177 additions and 158 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -51,14 +51,17 @@
window.process = process; window.process = process;
</script> </script>
<script src="https://unpkg.com/ohif-viewer@0.0.2/dist/index.umd.js" crossorigin></script> <script src="https://unpkg.com/ohif-viewer/dist/index.umd.js" crossorigin></script>
<!--<script src="http://localhost:3000/dist/index.umd.js" crossorigin></script>!-->
<!-- Load our React component. --> <!-- Load our React component. -->
<script> <script>
'use strict'; 'use strict';
// TODO: Add viewer config here // TODO: Add viewer config here
var props = {}; var props = {
routerBasename: window.location.pathname
};
/* /*

View File

@ -1,6 +1,6 @@
{ {
"name": "ohif-viewer", "name": "ohif-viewer",
"version": "0.0.2", "version": "0.0.3",
"description": "OHIF Viewer", "description": "OHIF Viewer",
"author": "OHIF Contributors", "author": "OHIF Contributors",
"license": "MIT", "license": "MIT",

View File

@ -136,11 +136,15 @@ OHIF.utils.addServers(servers, store);
window.store = store; window.store = store;
class App extends Component { class App extends Component {
static propTypes = {
routerBasename: PropTypes.string
}
render() { render() {
return ( return (
<Provider store={store}> <Provider store={store}>
{/*<OidcProvider store={store} userManager={userManager}>*/} {/*<OidcProvider store={store} userManager={userManager}>*/}
<BrowserRouter basename={props.routerBasename}> <BrowserRouter basename={this.props.routerBasename}>
<OHIFStandaloneViewer/> <OHIFStandaloneViewer/>
</BrowserRouter> </BrowserRouter>
{/*</OidcProvider>*/} {/*</OidcProvider>*/}

View File

@ -34,7 +34,7 @@ OHIF.external.cornerstoneMath = cornerstoneMath;
OHIF.external.cornerstoneWADOImageLoader = cornerstoneWADOImageLoader; OHIF.external.cornerstoneWADOImageLoader = cornerstoneWADOImageLoader;
// TODO: Is there a better way to guess ROOT_URL? // TODO: Is there a better way to guess ROOT_URL?
let ROOT_URL = homepage; let ROOT_URL = window.location.pathname;
// If the page we are on is not a subset of the expected homepage // If the page we are on is not a subset of the expected homepage
// provided in the package.json file, we might be doing local development. // provided in the package.json file, we might be doing local development.