import React from 'react'
import { Route, IndexRoute } from 'react-router'

import { changePage } from './actions/PostsActions'
import { App } from './components'
import {
  Post, 
  Posts } from './containers'

export default ({ dispatch }) => {
  return (
    <Route path="/" component={ App }>
      { /*<IndexRoute component={ Posts } />*/ }
      { /*<Route path="/:year/:month/:date/:slug" component={ Post } />*/ }
      <Route path="/pages/:page" getComponent={ 
        (nextState, callback) => {
          const { params } = nextState

          dispatch(
            changePage(
              parseInt(params.page)
            )
          )
          
          callback(null, Posts)
        } 
      } />
    </Route>
  )
}
@@ -296,20 +296,16 @@
 %3E%0A      
-%7B /*
 %3CIndexRo
@@ -334,23 +334,15 @@
 %7D /%3E
-*/ %7D
 %0A      
-%7B /*
 %3CRou
@@ -402,12 +402,8 @@
 %7D /%3E
-*/ %7D
 %0A   

Enable index route