Add api demos and make action names clearer
This commit is contained in:
@@ -5,20 +5,35 @@ import { Provider } from 'react-redux';
|
||||
|
||||
import { reducers } from './state';
|
||||
import * as WorkloadActions from './state/workloads/actions';
|
||||
import { WorkloadService } from './state/workloads/services';
|
||||
|
||||
import './index.css';
|
||||
import App from './App';
|
||||
|
||||
|
||||
// demo store
|
||||
|
||||
const store = createStore(reducers);
|
||||
|
||||
store.subscribe(() => {
|
||||
console.log(store.getState().workloads[0]);
|
||||
console.log('store workload[0]', 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' }));
|
||||
store.dispatch(WorkloadActions.created({ id: 0, complexity: 100, completeDate: new Date() }));
|
||||
store.dispatch(WorkloadActions.cancel({ id: 0 }));
|
||||
store.dispatch(WorkloadActions.updateStatus({ id: 0, status: 'SUCCESS' }));
|
||||
|
||||
|
||||
// demo workloadService
|
||||
|
||||
const workloadService = new WorkloadService();
|
||||
|
||||
workloadService.create({ complexity: 100 }).then(console.log.bind(console, 'create'));
|
||||
workloadService.cancel({ id: 0 }).then(console.log.bind(console, 'cancel'));
|
||||
|
||||
workloadService.create({ complexity: 200 }).then(console.log.bind(console, 'create'));
|
||||
workloadService.checkStatus({ id: 1 }).then(console.log.bind(console, 'checkStatus'));
|
||||
|
||||
|
||||
ReactDOM.render(
|
||||
|
||||
Reference in New Issue
Block a user