af83/chouette-core

View on GitHub
app/packs/entrypoints/journey_patterns/index.js

Summary

Maintainability
A
1 hr
Test Coverage
import React from 'react'
import { render } from 'react-dom'
import { Provider } from 'react-redux'
import { createStore } from 'redux'
import applyMiddleware from '../../src/helpers/middlewares'
import journeyPatternsApp from '../../src/journey_patterns/reducers'
import App from '../../src/journey_patterns/components/App'

const initialState = {
  editMode: false,
  status: {
    policy: window.perms,
    features: window.features,
    fetchSuccess: true,
    isFetching: false
  },
  journeyPatterns: [],
  stopPointsList: window.stopPoints,
  pagination: {
    page : 1,
    totalCount: window.journeyPatternLength,
    perPage: window.journeyPatternsPerPage,
    stateChanged: false
  },
  modal: {
    type: '',
    modalProps: {},
    confirmModal: {}
  },
  custom_fields: window.custom_fields
}

const store = createStore(
  journeyPatternsApp,
  initialState,
  applyMiddleware()
)

document.addEventListener("DOMContentLoaded", () => {
  if (document.getElementById("journey_patterns")) {
    render(
      <Provider store={store}>
        <App />
      </Provider>,
      document.getElementById('journey_patterns')
    )
  }
})