<commit_before>'use strict'
import React from 'react'
import {Router, Route, IndexRedirect, browserHistory} from 'react-router'
import {render} from 'react-dom'
import {connect, Provider} from 'react-redux'

import store from './store'
import Home from './components/Home'
import Login from './components/Login'
import Navbar from './components/Navbar'
import WhoAmI from './components/WhoAmI'
import NotFound from './components/NotFound'
import axios from 'axios'
import  {getFaces} from './reducers/faces'
import FacesContainer from './containers/FacesContainer'

const onAppEnter = () => {
  //const pFaces = axios.get('/api/faces')
  // const pUsers = axios.get('/api/users')
  // return Promise.all([pFaces])
  //   .then(responses => responses.map(r => r.data))
  //   .then(([faces]) => {
  //     store.dispatch(receiveFaces(faces));
  //   })
  store.dispatch(getFaces())
}

const onFacesEnter = () => {
  const faces = axios.get('/api/faces')
  store.dispatch(receiveFaces(faces))
}

import FaceContainer from './containers/FaceContainer'
import FacesContainer from './containers/FacesContainer'

import {getFaces} from './reducers/faces'
import {getFace} from './reducers/faces'

const ExampleApp = connect(
  ({ auth }) => ({ user: auth })
)(
  ({ user, children }) =>
    <div>
     <Navbar />
      {children}
    </div>
)

const onAppEnter = () => {
  store.dispatch(getFaces())
}

const onFaceEnter = function (nextRouterState) {
  const faceId = nextRouterState.params.faceId;
  store.dispatch(getFace(faceId))
}

render(
  <Provider store={store}>
    <Router history={browserHistory}>
      <Route path="/" component={ExampleApp}>
        <IndexRedirect to="/home" />
        <Route path="/home" component={FacesContainer} onEnter={onAppEnter} />
        <Route path="/faces/:faceId" component={FaceContainer} onEnter={onFaceEnter}/>
        <Route path="/faces" component={FacesContainer} onEnter={onAppEnter} />
      </Route>
      <Route path='*' component={NotFound} />
    </Router>
  </Provider>,
  document.getElementById('main')
)<commit_msg>fixed some duplicate declarations<commit_after>'use strict'
import React from 'react'
import {Router, Route, IndexRedirect, browserHistory} from 'react-router'
import {render} from 'react-dom'
import {connect, Provider} from 'react-redux'

import store from './store'
import Home from './components/Home'
import Login from './components/Login'
import Navbar from './components/Navbar'
import WhoAmI from './components/WhoAmI'
import NotFound from './components/NotFound'
import axios from 'axios'

import FaceContainer from './containers/FaceContainer'
import FacesContainer from './containers/FacesContainer'

import {getFaces} from './reducers/faces'
import {getFace} from './reducers/faces'

const ExampleApp = connect(
  ({ auth }) => ({ user: auth })
)(
  ({ user, children }) =>
    <div>
     <Navbar />
      {children}
    </div>
)

const onAppEnter = () => {
  store.dispatch(getFaces())
}

const onFacesEnter = () => {
  const faces = axios.get('/api/faces')
  store.dispatch(receiveFaces(faces))
}

const onFaceEnter = function (nextRouterState) {
  const faceId = nextRouterState.params.faceId;
  store.dispatch(getFace(faceId))
}

render(
  <Provider store={store}>
    <Router history={browserHistory}>
      <Route path="/" component={ExampleApp}>
        <IndexRedirect to="/home" />
        <Route path="/home" component={FacesContainer} onEnter={onAppEnter} />
        <Route path="/faces/:faceId" component={FaceContainer} onEnter={onFaceEnter}/>
        <Route path="/faces" component={FacesContainer} onEnter={onAppEnter} />
      </Route>
      <Route path='*' component={NotFound} />
    </Router>
  </Provider>,
  document.getElementById('main')
)
{'fraction_non_alphanumeric': 0.15900587920897916, 'fraction_numerical': 0.0, 'mean_word_length': 4.051282051282051, 'pattern_counts': {'":': 0, '<': 31, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5846985', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1133, 'n_words': 275}