"use client"; import { useRouter } from "next/navigation"; import { useToast } from "@/components/Toast"; import { type ApiError, api } from "@/lib/client/api"; export function WorkerActions({ id, status, draining }: { id: string; status: string; draining: boolean }) { const router = useRouter(); const toast = useToast(); const run = async (path: string, body: unknown, msg: string) => { try { await api(path, { json: body }); toast.push("success", msg); router.refresh(); } catch (e) { toast.push("error", (e as ApiError).message); } }; return (
{status === "quarantined" ? ( ) : ( )}
); }