|
- "use server";
- import { ServerFetchError, serverFetchJson, serverFetchWithNoContent } from "@/app/utils/fetchUtil";
- import { revalidateTag } from "next/cache";
- import { BASE_API_URL } from "@/config/api";
-
- export type CreateMaterialInputs = {
- name: string;
- }
-
- export const saveMaterial = async (data: CreateMaterialInputs) => {
- // try {
- const materials = await serverFetchJson(`${BASE_API_URL}/materials/save`, {
- method: "POST",
- body: JSON.stringify(data),
- headers: { "Content-Type": "application/json" },
- });
- revalidateTag("materials");
- return materials
- };
|