✨ feat: improve NewMilestoneForm.tsx
swadhinbiswas committed 3 months ago
9f9cf5d
1 parent 9004b79
commit 9f9cf5d
1 file changed
+4 -3
Showing 1 changed file+4-3
▼src/components/milestones/NewMilestoneForm.tsx
+4-3
| @@ -9,6 +9,7 @@ import { | ||
9 | 9 | X |
10 | 10 | } from "lucide-react"; |
11 | 11 | import { useState } from "react"; |
12 | +import { toast } from "sonner"; | |
12 | 13 | |
13 | 14 | interface Props { |
14 | 15 | repoOwner: string; |
| @@ -34,18 +35,18 @@ export default function NewMilestoneForm({ repoOwner, repoName }: Props) { | ||
34 | 35 | body: JSON.stringify({ |
35 | 36 | title: title.trim(), |
36 | 37 | description: description.trim() || null, |
37 | - dueOn: dueDate || null, | |
38 | + dueDate: dueDate || null, | |
38 | 39 | }), |
39 | 40 | }); |
40 | 41 | |
41 | 42 | if (res.ok) { |
42 | 43 | window.location.href = `/${repoOwner}/${repoName}/milestones`; |
43 | 44 | } else { |
44 | - alert("Failed to create milestone"); | |
45 | + toast.error("Failed to create milestone"); | |
45 | 46 | } |
46 | 47 | } catch (error) { |
47 | 48 | console.error("Error creating milestone:", error); |
48 | - alert("Failed to create milestone"); | |
49 | + toast.error("Failed to create milestone"); | |
49 | 50 | } finally { |
50 | 51 | setIsSubmitting(false); |
51 | 52 | } |
52 | 53 | |