Add basic 'workloads' Redux app
This commit is contained in:
@@ -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'),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user