"use server"; import { categorySchema } from "@/lib/validation/zod/category"; import { api } from "@/trpc/server"; import { revalidatePath } from "next/cache"; import { z } from "zod"; export async function createCategory(category: z.infer) { const result = await api.category.create({ category, }); if (!result[0]?.slug?.length) return false; return revalidatePath("/"); } export async function updateCategory( category: z.infer, categoryId: string, ) { const result = await api.category.update({ category, categoryId, }); // if (!result[0]?.id?.length) return false; // return revalidatePath(`/artikel/${result[0].id}/edit`); } export async function deleteCategory(categoryId: string) { const result = await api.category.delete({ categoryId, }); }