fixing up the connect so it actually calls the thunk version of clear

This commit is contained in:
Ken 2019-02-01 10:34:13 -08:00
Родитель 1b7775d784
Коммит 73ff9cdea7
5 изменённых файлов: 16 добавлений и 6 удалений

9
package-lock.json сгенерированный
Просмотреть файл

@ -213,6 +213,15 @@
"@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": {
"version": "0.1.1",
"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/redux": "^3.6.0",
"@types/cors": "^2.8.4",
"@types/uuid": "^3.4.4",
"body-parser": "^1.18.3",
"cors": "^2.8.5",
"html-webpack-plugin": "^3.2.0",
@ -34,7 +35,8 @@
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14",
"npm-run-all": "^4.1.5",
"nodemon": "^1.18.9"
"nodemon": "^1.18.9",
"uuid": "^3.3.2"
},
"dependencies": {
"@uifabric/experiments": "^6.51.1",

Просмотреть файл

@ -1,12 +1,11 @@
import { action, GenericActionTypes, GenericAction, GenericActionLookup } from '../redux-utils/action';
import { Dispatch } from 'redux';
import { Store } from '../store';
import uuid from 'uuid/v4';
import * as todosService from '../service/todosService';
let counter = 0;
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 }),
edit: (id: string, label: string) => action('edit', { id, label }),
complete: (id: string) => action('complete', { id }),

Просмотреть файл

@ -17,7 +17,7 @@ export function mapDispatchToProps(dispatch: any) {
remove: (id: string) => dispatch(actionsWithService.remove(id)),
complete: (id: string) => dispatch(actionsWithService.complete(id)),
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))
};
}

Просмотреть файл

@ -29,7 +29,7 @@ app.delete('/todos/:id', (req, res) => {
delete store.todos[req.body.id];
});
app.post('/todos', (req, res) => {
app.post('/todos', req => {
store.todos = req.body;
});