mirror of
https://github.com/mgerb/mywebsite
synced 2026-01-11 18:32:50 +00:00
fixed routing
This commit is contained in:
@@ -12,14 +12,9 @@ import store, {history} from './redux/store';
|
||||
import * as actions from './redux/actions';
|
||||
|
||||
import Index from './pages/Index';
|
||||
|
||||
class Main extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<div>{React.cloneElement(this.props.children, this.props)}</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
import Preview from './components/Preview';
|
||||
import Post from './components/Post';
|
||||
import SensorInfo from './components/sensors/SensorInfo';
|
||||
|
||||
function mapStateToProps(state) {
|
||||
return {
|
||||
@@ -33,14 +28,15 @@ function mapDispatchToProps(dispatch) {
|
||||
}
|
||||
}
|
||||
|
||||
const App = connect(mapStateToProps, mapDispatchToProps)(Main);
|
||||
const App = connect(mapStateToProps, mapDispatchToProps)(Index);
|
||||
|
||||
ReactDOM.render((
|
||||
<Provider store={store}>
|
||||
<Router history={history}>
|
||||
<Route path="/" component={App}>
|
||||
<IndexRoute component={Index}/>
|
||||
<Route path="/:page(/:category)(/:post)" component={Index}/>
|
||||
<IndexRoute component={Preview}/>
|
||||
<Route path="post/:category/:post" component={Post}/>
|
||||
<Route path="sensor/:location/:year/:month" component={SensorInfo}/>
|
||||
</Route>
|
||||
</Router>
|
||||
</Provider>
|
||||
|
||||
Reference in New Issue
Block a user