20 lines
629 B
TypeScript
20 lines
629 B
TypeScript
"use client";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { Spinner } from "@/components/ui/spinner";
|
|
import { useAction } from "@/hooks/useAction";
|
|
import { vetoActAction } from "@/lib/acts/actions";
|
|
import { XIcon } from "lucide-react";
|
|
|
|
export function VetoButton({ actId, vetoLabel }: { actId: string, vetoLabel: string }) {
|
|
const { run, isPending } = useAction(vetoActAction, {
|
|
successMessage: "Vetoed",
|
|
});
|
|
|
|
return (
|
|
<Button variant="destructive" className="w-max" disabled={isPending} onClick={() => run(actId)}>
|
|
{isPending ? <Spinner /> : <XIcon />}
|
|
{vetoLabel}
|
|
</Button>
|
|
);
|
|
} |