Add basic 'workloads' Redux app

This commit is contained in:
James Greenaway
2019-01-28 18:21:58 +00:00
parent e1a3f27d8f
commit 986cf86403
13 changed files with 231 additions and 210 deletions

View File

@@ -1,12 +1,31 @@
import React from 'react';
import ReactDOM from 'react-dom';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import { reducers } from './state';
import * as WorkloadActions from './state/workloads/actions';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(<App />, document.getElementById('root'));
// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: http://bit.ly/CRA-PWA
serviceWorker.unregister();
const store = createStore(reducers);
store.subscribe(() => {
console.log(store.getState().workloads[0]);
});
store.dispatch(WorkloadActions.submit({ complexity: 100 }));
store.dispatch(WorkloadActions.create({ workloadId: 0, complexity: 100, completeDate: new Date() }));
store.dispatch(WorkloadActions.updateStatus({ workloadId: 0, status: 'SUCCESS' }));
ReactDOM.render(
(
<Provider store={store}>
<App />
</Provider>
),
document.getElementById('root'),
);