File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,7 @@ ul.id = "todoList"
2222
2323
2424todoHandler . addEventListener ( 'click' , async ( ) => {
25- let inputVal = todoInput . value . trim ( )
25+ let inputVal = todoInput . value
2626 if ( ! inputVal ) {
2727 alert ( "field is empty" )
2828 return ;
@@ -79,15 +79,18 @@ ul.addEventListener('click', async (e) => {
7979 input . style . border = ""
8080 input . nextElementSibling . innerText = "Edit"
8181 }
82+
8283 let newVal = input . value
8384 let id = input . id
84- try {
85- await updateDoc ( doc ( db , "Todo" , id ) , {
86- todo : newVal
87- } )
88- } catch ( error ) {
89- console . log ( "The Error is in UpdateDoc" , error ) ;
85+ if ( newVal ) {
86+ try {
87+ await updateDoc ( doc ( db , "Todo" , id ) , {
88+ todo : newVal
89+ } )
90+ } catch ( error ) {
91+ console . log ( "The Error is in UpdateDoc" , error ) ;
9092
93+ }
9194 }
9295 }
9396
You can’t perform that action at this time.
0 commit comments