Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/modules/todos/components/toggle-complete.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"use client";

import { useState, useTransition } from "react";
import toast from "react-hot-toast";
import { Checkbox } from "@/components/ui/checkbox";
import { updateTodoFieldAction } from "../actions/update-todo.action";

Expand Down Expand Up @@ -31,8 +32,8 @@ export function ToggleComplete({ todoId, completed }: ToggleCompleteProps) {
console.error("Error updating todo:", error);
// Revert the optimistic update
setIsCompleted(!checked);
alert(
`Error updating todo: ${error instanceof Error ? error.message : "Unknown error"}`,
toast.error(
error instanceof Error ? error.message : "Failed to update todo",
);
}
});
Expand Down