()
| 27 | const router = useRouter(); |
| 28 | const [newCategory, setNewCategory] = useState<string>(""); |
| 29 | async function handleAddCategory() { |
| 30 | if (!newCategory) { |
| 31 | toast({ |
| 32 | title: "Category cannot be empty", |
| 33 | description: "Please enter a category", |
| 34 | }); |
| 35 | return; |
| 36 | } |
| 37 | toast({ |
| 38 | title: "Adding category", |
| 39 | }); |
| 40 | try { |
| 41 | await addCategory(newCategory); |
| 42 | router.refresh(); |
| 43 | toast({ |
| 44 | title: "Category added", |
| 45 | description: `Category ${newCategory} added`, |
| 46 | }); |
| 47 | } catch (error) { |
| 48 | toast({ |
| 49 | title: "Error adding category", |
| 50 | }); |
| 51 | } |
| 52 | } |
| 53 | async function handleDeleteCategory(categoryId: string) { |
| 54 | toast({ |
| 55 | title: "Deleting category", |
nothing calls this directly
no test coverage detected