20 lines
592 B
TypeScript
20 lines
592 B
TypeScript
"use client";
|
|
|
|
import { Button } from "@/components/ui/button";
|
|
import { Spinner } from "@/components/ui/spinner";
|
|
import { useAction } from "@/hooks/useAction";
|
|
import { approveActAction } from "@/lib/acts/actions";
|
|
import { CheckIcon } from "lucide-react";
|
|
|
|
export function ApproveButton({ actId }: { actId: string }) {
|
|
const { run, isPending } = useAction(approveActAction, {
|
|
successMessage: "Approved",
|
|
});
|
|
|
|
return (
|
|
<Button className="w-max" disabled={isPending} onClick={() => run(actId)}>
|
|
{isPending ? <Spinner /> : <CheckIcon />}
|
|
Approve
|
|
</Button>
|
|
);
|
|
} |