FPSMS-frontend
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
 
 

28 righe
674 B

  1. "use server";
  2. import { serverFetchJson } from "@/app/utils/fetchUtil";
  3. import { BASE_API_URL } from "@/config/api";
  4. import { TaskTemplate } from ".";
  5. import { revalidateTag } from "next/cache";
  6. export interface NewTaskTemplateFormInputs {
  7. code: string;
  8. name: string;
  9. taskIds: number[];
  10. }
  11. export const saveTaskTemplate = async (data: NewTaskTemplateFormInputs) => {
  12. const newTaskTemplate = await serverFetchJson<TaskTemplate>(
  13. `${BASE_API_URL}/tasks/templates/new`,
  14. {
  15. method: "POST",
  16. body: JSON.stringify(data),
  17. headers: { "Content-Type": "application/json" },
  18. },
  19. );
  20. revalidateTag("taskTemplates");
  21. return newTaskTemplate;
  22. };