mirror of
https://github.com/microsoft/frontend-bootcamp.git
synced 2026-01-26 14:56:42 +08:00
fixing up the connect so it actually calls the thunk version of clear
This commit is contained in:
9
package-lock.json
generated
9
package-lock.json
generated
@@ -213,6 +213,15 @@
|
|||||||
"@types/mime": "*"
|
"@types/mime": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"@types/uuid": {
|
||||||
|
"version": "3.4.4",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.4.tgz",
|
||||||
|
"integrity": "sha512-tPIgT0GUmdJQNSHxp0X2jnpQfBSTfGxUMc/2CXBU2mnyTFVYVa2ojpoQ74w0U2yn2vw3jnC640+77lkFFpdVDw==",
|
||||||
|
"dev": true,
|
||||||
|
"requires": {
|
||||||
|
"@types/node": "*"
|
||||||
|
}
|
||||||
|
},
|
||||||
"@uifabric/azure-themes": {
|
"@uifabric/azure-themes": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/@uifabric/azure-themes/-/azure-themes-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/@uifabric/azure-themes/-/azure-themes-0.1.1.tgz",
|
||||||
|
|||||||
@@ -23,6 +23,7 @@
|
|||||||
"@types/react-redux": "^7.0.0",
|
"@types/react-redux": "^7.0.0",
|
||||||
"@types/redux": "^3.6.0",
|
"@types/redux": "^3.6.0",
|
||||||
"@types/cors": "^2.8.4",
|
"@types/cors": "^2.8.4",
|
||||||
|
"@types/uuid": "^3.4.4",
|
||||||
"body-parser": "^1.18.3",
|
"body-parser": "^1.18.3",
|
||||||
"cors": "^2.8.5",
|
"cors": "^2.8.5",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"html-webpack-plugin": "^3.2.0",
|
||||||
@@ -34,7 +35,8 @@
|
|||||||
"webpack-cli": "^3.2.1",
|
"webpack-cli": "^3.2.1",
|
||||||
"webpack-dev-server": "^3.1.14",
|
"webpack-dev-server": "^3.1.14",
|
||||||
"npm-run-all": "^4.1.5",
|
"npm-run-all": "^4.1.5",
|
||||||
"nodemon": "^1.18.9"
|
"nodemon": "^1.18.9",
|
||||||
|
"uuid": "^3.3.2"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@uifabric/experiments": "^6.51.1",
|
"@uifabric/experiments": "^6.51.1",
|
||||||
|
|||||||
@@ -1,12 +1,11 @@
|
|||||||
import { action, GenericActionTypes, GenericAction, GenericActionLookup } from '../redux-utils/action';
|
import { action, GenericActionTypes, GenericAction, GenericActionLookup } from '../redux-utils/action';
|
||||||
import { Dispatch } from 'redux';
|
import { Dispatch } from 'redux';
|
||||||
import { Store } from '../store';
|
import { Store } from '../store';
|
||||||
|
import uuid from 'uuid/v4';
|
||||||
import * as todosService from '../service/todosService';
|
import * as todosService from '../service/todosService';
|
||||||
|
|
||||||
let counter = 0;
|
|
||||||
|
|
||||||
export const actions = {
|
export const actions = {
|
||||||
add: (label: string) => action('add', { id: String(counter++), label }),
|
add: (label: string) => action('add', { id: uuid(), label }),
|
||||||
remove: (id: string) => action('remove', { id }),
|
remove: (id: string) => action('remove', { id }),
|
||||||
edit: (id: string, label: string) => action('edit', { id, label }),
|
edit: (id: string, label: string) => action('edit', { id, label }),
|
||||||
complete: (id: string) => action('complete', { id }),
|
complete: (id: string) => action('complete', { id }),
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ export function mapDispatchToProps(dispatch: any) {
|
|||||||
remove: (id: string) => dispatch(actionsWithService.remove(id)),
|
remove: (id: string) => dispatch(actionsWithService.remove(id)),
|
||||||
complete: (id: string) => dispatch(actionsWithService.complete(id)),
|
complete: (id: string) => dispatch(actionsWithService.complete(id)),
|
||||||
edit: (id: string, label: string) => dispatch(actionsWithService.edit(id, label)),
|
edit: (id: string, label: string) => dispatch(actionsWithService.edit(id, label)),
|
||||||
clear: () => dispatch(actions.clear()),
|
clear: () => dispatch(actionsWithService.clear()),
|
||||||
setFilter: (filter: FilterTypes) => dispatch(actions.filter(filter))
|
setFilter: (filter: FilterTypes) => dispatch(actions.filter(filter))
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ app.delete('/todos/:id', (req, res) => {
|
|||||||
delete store.todos[req.body.id];
|
delete store.todos[req.body.id];
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post('/todos', (req, res) => {
|
app.post('/todos', req => {
|
||||||
store.todos = req.body;
|
store.todos = req.body;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user