feat: add delete functionality to admin forms list and correct redirection paths

This commit is contained in:
2026-06-30 17:17:20 +07:00 Unverified
parent 14abb54108
commit 01e97bb6c6
2 changed files with 9 additions and 3 deletions
+7 -1
View File
@@ -11,8 +11,9 @@ import {
TableRow,
} from "@/components/ui/table";
import { Badge } from "@/components/ui/badge";
import { Plus } from "lucide-react";
import { Plus, Trash2 } from "lucide-react";
import { redirect } from "next/navigation";
import { deleteForm } from "@/app/actions/form";
export const dynamic = "force-dynamic";
@@ -83,6 +84,11 @@ export default async function AdminFormsPage() {
<Button variant="outline" asChild size="sm">
<Link href={`/admin/form/${form.id}/result`}>Results</Link>
</Button>
<form className="inline-block" action={deleteForm.bind(null, form.id)}>
<Button variant="outline" size="sm" type="submit" className="text-destructive hover:text-destructive">
<Trash2 className="h-4 w-4" />
</Button>
</form>
</TableCell>
</TableRow>
))