mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 03:22:11 +00:00
using hash router with custom history instance
This commit is contained in:
parent
17cc5a2361
commit
aa19a2d804
1 changed files with 10 additions and 3 deletions
|
|
@ -1,19 +1,26 @@
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
import { HashRouter, Switch, Route, Redirect } from 'react-router-dom';
|
import { Router, Switch, Route, Redirect } from 'react-router-dom';
|
||||||
|
import { createHashHistory } from 'history';
|
||||||
import { Main, Addons } from 'stremio-routes';
|
import { Main, Addons } from 'stremio-routes';
|
||||||
import styles from './styles';
|
import styles from './styles';
|
||||||
|
|
||||||
class App extends PureComponent {
|
class App extends PureComponent {
|
||||||
|
constructor(props) {
|
||||||
|
super(props);
|
||||||
|
|
||||||
|
this.history = createHashHistory();
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<div className={styles['app']}>
|
<div className={styles['app']}>
|
||||||
<HashRouter>
|
<Router history={this.history}>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route path={'/(discover|library|calendar|search)?'} exact={true} component={Main} />
|
<Route path={'/(discover|library|calendar|search)?'} exact={true} component={Main} />
|
||||||
<Route path={'/addons'} component={Addons} />
|
<Route path={'/addons'} component={Addons} />
|
||||||
<Redirect to={'/'} />
|
<Redirect to={'/'} />
|
||||||
</Switch>
|
</Switch>
|
||||||
</HashRouter>
|
</Router>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue