@teikei/map
Version:
Teikei map SPA component. Teikei is the software that powers ernte-teilen.org, a website that maps out Community-supported Agriculture in Germany.
63 lines (51 loc) • 1.7 kB
JavaScript
import React from 'react'
import { createStore, applyMiddleware, compose, combineReducers } from 'redux'
import superagent from 'superagent'
import { reducer as formReducer } from 'redux-form'
import { Provider } from 'react-redux'
import thunk from 'redux-thunk'
import reduxPromise from 'redux-promise-middleware'
import feathers from 'feathers-client'
import AuthManagement from 'feathers-authentication-management/lib/client'
import { user } from './containers/UserOnboarding/duck'
import { map } from './containers/Map/duck'
import { details } from './containers/Details/duck'
import { editor } from './containers/EntryForm/duck'
import { search } from './containers/Search/duck'
import AppRouter from './AppRouter'
import './site'
import './App.css'
import withAuthentication from './Authentication'
const apiUrl = process.env.REACT_APP_API_URL
export const client = feathers()
client.configure(feathers.hooks())
const restClient = feathers.rest(apiUrl).superagent(superagent)
client.configure(restClient)
client.configure(
feathers.authentication({
storage: window.localStorage
})
)
export const authManagement = new AuthManagement(client)
const reducer = combineReducers({
user,
map,
details,
editor,
search,
form: formReducer
})
const enhancers = compose(
applyMiddleware(thunk, reduxPromise()),
window.devToolsExtension ? window.devToolsExtension() : f => f
)
const AuthenticatedAppRouter = withAuthentication(AppRouter)
const store = createStore(reducer, enhancers)
const App = () => (
<div className="teikei-embed">
<Provider store={store}>
<AuthenticatedAppRouter dispatch={store.dispatch} />
</Provider>
</div>
)
export default App