Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
KoheiAsano
committed
Dec 18, 2018
1 parent
b188ec8
commit 99595b6
Showing
1 changed file
with
23 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,23 @@ | ||
let nextTodoId = 0 | ||
export const addTodo = text => ({ | ||
type: 'ADD_TODO', | ||
id: nextTodoId++, | ||
text | ||
}) | ||
export const toggleTodo = id => ({ | ||
type: 'TOGGLE_TODO', | ||
id | ||
}) | ||
export const setVisibilityFilter = filter => ({ | ||
type: 'SET_VISIBILITY_FILTER', | ||
filter | ||
}) | ||
|
||
let nextTodoId = 0; | ||
export const addTodo = text => dispatch => { | ||
return dispatch({ | ||
type: 'ADD_TODO', | ||
id: nextTodoId++, | ||
text | ||
}) | ||
} | ||
|
||
export const toggleTodo = id => dispatch => { | ||
return dispatch({ | ||
type: 'TOGGLE_TODO', | ||
id | ||
}) | ||
} | ||
|
||
export const setVisibilityFilter = filter => dispatch =>{ | ||
return dispatch({ | ||
type: 'SET_VISIBILITY_FILTER', | ||
filter | ||
}) | ||
} |