export const RowActionDeleteButton = ({ id, trpcRouter,}: { id: string trpcRouter: RouterLike<AppRouter["module"]> | RouterLike<AppRouter["lesson"]>}) => { const router = useRouter() const deleteMutation = trpcRouter.delete.useMutation({ onSuccess: () => { router.reload() toast.success(`Key ${id} deleted`) }, onError: (err, variables) => { router.reload() toast.error(`Error deleting key ${id}`) console.error(err, variables) }, }) return ( <Button variant="destructive" onClick={() => deleteMutation.mutate({ id })}> Delete </Button> )}