We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent d5ebbcc commit 976e51cCopy full SHA for 976e51c
1 file changed
‎Todo/public/app.js‎
@@ -22,7 +22,7 @@ ul.id = "todoList"
22
23
24
todoHandler.addEventListener('click', async () => {
25
- let inputVal = todoInput.value.trim()
+ let inputVal = todoInput.value
26
if (!inputVal) {
27
alert("field is empty")
28
return;
@@ -79,15 +79,18 @@ ul.addEventListener('click', async (e) => {
79
input.style.border = ""
80
input.nextElementSibling.innerText = "Edit"
81
}
82
+
83
let newVal = input.value
84
let id = input.id
- try {
85
- await updateDoc(doc(db, "Todo", id), {
86
- todo: newVal
87
- })
88
- } catch (error) {
89
- console.log("The Error is in UpdateDoc", error);
+ if (newVal) {
+ try {
+ await updateDoc(doc(db, "Todo", id), {
+ todo: newVal
+ })
90
+ } catch (error) {
91
+ console.log("The Error is in UpdateDoc", error);
92
93
+ }
94
95
96
0 commit comments