Add form component, redux devtools and fix reducers
This commit is contained in:
@@ -1,21 +1,27 @@
|
||||
import React from 'react';
|
||||
import ReactDOM from 'react-dom';
|
||||
import { createStore, applyMiddleware } from 'redux';
|
||||
import { createStore, applyMiddleware, compose } from 'redux';
|
||||
import { Provider } from 'react-redux';
|
||||
import { createEpicMiddleware } from 'redux-observable';
|
||||
import moment from 'moment';
|
||||
|
||||
import { reducers, epics, Action, State } from './state';
|
||||
import { reducer, epics, Action, State } from './state';
|
||||
import * as WorkloadActions from './state/workloads/actions';
|
||||
import './index.css';
|
||||
import App from './components/App';
|
||||
|
||||
|
||||
const epicMiddleware = createEpicMiddleware<Action, Action, State>();
|
||||
const store = createStore(reducers, applyMiddleware(epicMiddleware));
|
||||
// @ts-ignore: use Redux devtools if installed in browser
|
||||
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
|
||||
|
||||
const epicMiddleware = createEpicMiddleware<Action, Action, State>();
|
||||
const store = createStore(reducer, composeEnhancers(applyMiddleware(epicMiddleware)));
|
||||
epicMiddleware.run(epics);
|
||||
store.dispatch(WorkloadActions.submit({ complexity: 100 }));
|
||||
store.dispatch(WorkloadActions.created({ id: 0, complexity: 100, completeDate: new Date() }));
|
||||
|
||||
// demo actions
|
||||
store.dispatch(WorkloadActions.submit({ complexity: 10 }));
|
||||
store.dispatch(WorkloadActions.created({ id: 0, complexity: 10, completeDate: moment().add(10, 'second').toDate() }));
|
||||
store.dispatch(WorkloadActions.created({ id: 1, complexity: 10, completeDate: moment().add(18, 'second').toDate() }));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user