- FIxed an issue with completing todos

This commit is contained in:
Dejan
2024-10-26 15:38:54 +02:00
parent b2b1e5d1e4
commit c597e96c20

View File

@ -13,12 +13,12 @@ export const useUpdateTodo = () => {
mutationKey: ["updateTodo"],
mutationFn: async (todoData: Partial<IToDo>) => {
try {
const snapshot = await firestore()
.collection("Todos")
.where("connectedTodoId", "==", todoData.connectedTodoId)
.get();
if (todoData.connectedTodoId) {
console.log("CONNECTED")
const snapshot = await firestore()
.collection("Todos")
.where("connectedTodoId", "==", todoData.connectedTodoId)
.get();
const connectedTodos = snapshot.docs.map((doc) => {
const data = doc.data();