got add, remove, and edit actions working

This commit is contained in:
Ken
2019-02-01 09:47:04 -08:00
parent 260b6177fe
commit 0e0ea2ef06
9 changed files with 860 additions and 108 deletions

View File

@@ -1,4 +1,4 @@
import { actions, TodoAction } from '../actions';
import { actions, actionsWithService } from '../actions';
import { Store, FilterTypes } from '../store';
import { connect } from 'react-redux';
import { Dispatch } from 'redux';
@@ -11,12 +11,12 @@ export function mapStateToProps({ todos, filter }: Store) {
};
}
export function mapDispatchToProps(dispatch: Dispatch<TodoAction>) {
export function mapDispatchToProps(dispatch: any) {
return {
add: (label: string) => dispatch(actions.add(label)),
remove: (id: string) => dispatch(actions.remove(id)),
complete: (id: string) => dispatch(actions.complete(id)),
edit: (id: string, label: string) => dispatch(actions.edit(id, label)),
add: (label: string) => dispatch(actionsWithService.add(label)),
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()),
setFilter: (filter: FilterTypes) => dispatch(actions.filter(filter))
};