router
This commit is contained in:
parent
4a50fe2cd6
commit
a563cbb9fa
|
@ -1,19 +1,16 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import * as ReactDOM from 'react-dom';
|
import * as ReactDOM from 'react-dom';
|
||||||
import { fork } from 'redux-saga/effects';
|
import { Provider, Store } from 'react-redux';
|
||||||
|
|
||||||
import { Provider } from 'react-redux';
|
|
||||||
import { ConnectedRouter } from 'react-router-redux';
|
import { ConnectedRouter } from 'react-router-redux';
|
||||||
import * as injectTapEventPlugin from 'react-tap-event-plugin';
|
|
||||||
import { Store } from 'redux';
|
|
||||||
|
|
||||||
import createSagaMiddleware, { SagaMiddleware } from 'redux-saga';
|
import createSagaMiddleware, { SagaMiddleware } from 'redux-saga';
|
||||||
|
import { History } from 'history';
|
||||||
|
|
||||||
|
import * as injectTapEventPlugin from 'react-tap-event-plugin';
|
||||||
|
|
||||||
import Platform from '@overflow/commons/platform';
|
import Platform from '@overflow/commons/platform';
|
||||||
import AppContext from '@overflow/commons/context';
|
import AppContext from '@overflow/commons/context';
|
||||||
import * as AppContextLifecycleActions from '@overflow/commons/context/redux/action/lifecycle';
|
import * as AppContextLifecycleActions from '@overflow/commons/context/redux/action/lifecycle';
|
||||||
import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC';
|
import WebSocketRPC from '@overflow/commons/websocket/WebSocketRPC';
|
||||||
import { History } from 'history';
|
|
||||||
import { store, sagaMiddleware, history } from './redux/store';
|
import { store, sagaMiddleware, history } from './redux/store';
|
||||||
|
|
||||||
import appConfig, { Config } from './config';
|
import appConfig, { Config } from './config';
|
||||||
|
@ -131,7 +128,11 @@ class Application {
|
||||||
|
|
||||||
private displayApp(): void {
|
private displayApp(): void {
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<App store={this.store} history={this.history} />,
|
<Provider store={this.store}>
|
||||||
|
<ConnectedRouter history={this.history}>
|
||||||
|
<App />
|
||||||
|
</ConnectedRouter>
|
||||||
|
</Provider>,
|
||||||
this.container,
|
this.container,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,8 +1,5 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import { History } from 'history';
|
|
||||||
import { Provider, Store } from 'react-redux';
|
|
||||||
import { Route, Switch } from 'react-router-dom';
|
import { Route, Switch } from 'react-router-dom';
|
||||||
import { ConnectedRouter } from 'react-router-redux';
|
|
||||||
|
|
||||||
import AccountLayout from './layout/AccountLayout';
|
import AccountLayout from './layout/AccountLayout';
|
||||||
import AppLayout from './layout/AppLayout';
|
import AppLayout from './layout/AppLayout';
|
||||||
|
@ -10,8 +7,6 @@ import AppLayout from './layout/AppLayout';
|
||||||
import TempLayout from './layout/TempLayout';
|
import TempLayout from './layout/TempLayout';
|
||||||
|
|
||||||
export interface Props {
|
export interface Props {
|
||||||
store: Store<any>;
|
|
||||||
history: History;
|
|
||||||
}
|
}
|
||||||
export interface State {
|
export interface State {
|
||||||
}
|
}
|
||||||
|
@ -24,15 +19,11 @@ class App extends React.Component<Props, State> {
|
||||||
|
|
||||||
public render(): JSX.Element {
|
public render(): JSX.Element {
|
||||||
return (
|
return (
|
||||||
<Provider store={this.props.store}>
|
<Switch>
|
||||||
<ConnectedRouter history={this.props.history}>
|
<Route path='/temp' component={TempLayout}/>
|
||||||
<Switch>
|
<Route path='/account' component={AccountLayout}/>
|
||||||
<Route path='/temp' component={TempLayout}/>
|
<Route path='/' component={AppLayout}/>
|
||||||
<Route path='/account' component={AccountLayout}/>
|
</Switch>
|
||||||
<Route path='/' component={AppLayout}/>
|
|
||||||
</Switch>
|
|
||||||
</ConnectedRouter>
|
|
||||||
</Provider>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user