Last active
September 9, 2020 05:37
-
-
Save perjo927/f093c5a67d3966e8f3c9c1a6fb3d7ea0 to your computer and use it in GitHub Desktop.
Todo App Actions
This file contains hidden or 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
export const CONSTS = { | |
actions: { | |
ADD: "ADD", | |
DELETE: "DELETE", | |
UNDO: "UNDO", | |
REDO: "REDO", | |
TOGGLE: "TOGGLE", | |
SET_VISIBILITY: "SET_VISIBILITY", | |
}, | |
visibilityFilters: { | |
ALL: "ALL", | |
DONE: "DONE", | |
IN_PROGRESS: "IN_PROGRESS", | |
}, | |
}; | |
export const actions = { | |
addTodo: (todo) => ({ | |
type: CONSTS.actions.ADD, | |
value: todo, | |
}), | |
deleteTodo: (id) => ({ | |
type: CONSTS.actions.DELETE, | |
value: id, | |
}), | |
toggleTodo: (id) => ({ | |
type: CONSTS.actions.TOGGLE, | |
value: id, | |
}), | |
undo: () => ({ | |
type: CONSTS.actions.UNDO, | |
value: null, | |
}), | |
redo: () => ({ | |
type: CONSTS.actions.REDO, | |
value: null, | |
}), | |
setVisibility: (filter) => ({ | |
type: CONSTS.actions.SET_VISIBILITY, | |
value: filter, | |
}), | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment