feat: add delete functionality to admin forms list and correct redirection paths
This commit is contained in:
@@ -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>
|
||||
))
|
||||
|
||||
Reference in New Issue
Block a user