| 29 | } |
| 30 | |
| 31 | const createTodo = async e => { |
| 32 | e.preventDefault(); |
| 33 | if (!todo) { |
| 34 | alert("please enter something"); |
| 35 | return; |
| 36 | } |
| 37 | if (todos.some(({ task }) => task === todo)) { |
| 38 | alert(`Task: ${todo} already exists`); |
| 39 | return; |
| 40 | } |
| 41 | setCommandOutput("Command in progress"); |
| 42 | setCommandOutput(await APIHelper.createTodo(todo)); |
| 43 | const todoList = await APIHelper.getAllTodos(); |
| 44 | setTodos([...todoList]); |
| 45 | }; |
| 46 | |
| 47 | const deleteTodo = async (e, id) => { |
| 48 | try { |
nothing calls this directly
no outgoing calls
no test coverage detected