25'ten fazla konu seçemezsiniz Konular bir harf veya rakamla başlamalı, kısa çizgiler ('-') içerebilir ve en fazla 35 karakter uzunluğunda olabilir.

actions.ts 1.1 KiB

1 yıl önce
1 yıl önce
1 yıl önce
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. "use server";
  2. import { BASE_API_URL } from "@/config/api";
  3. import { Claim, ProjectCombo, SupportingDocument } from ".";
  4. import { serverFetchJson } from "@/app/utils/fetchUtil";
  5. import { revalidateTag } from "next/cache";
  6. export interface ClaimInputFormByStaff {
  7. id: number | null;
  8. code: string | null;
  9. expenseType: string;
  10. status: string;
  11. addClaimDetails: ClaimDetailTable[]
  12. }
  13. export interface ClaimDetailTable {
  14. id: number;
  15. invoiceDate: Date;
  16. description: string;
  17. project: ProjectCombo;
  18. amount: number;
  19. supportingDocumentName: string;
  20. oldSupportingDocument: SupportingDocument;
  21. newSupportingDocument: File;
  22. isNew: boolean;
  23. }
  24. export interface SaveClaimResponse {
  25. claim: Claim;
  26. message: string;
  27. }
  28. export const saveClaim = async (data: FormData) => {
  29. console.log(data)
  30. const saveCustomer = await serverFetchJson<SaveClaimResponse>(
  31. `${BASE_API_URL}/claim/save`,
  32. {
  33. method: "POST",
  34. body: data,
  35. // headers: { "Content-Type": "multipart/form-data" },
  36. },
  37. );
  38. revalidateTag("claims");
  39. return saveCustomer;
  40. };