FPSMS-frontend
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

31 lines
813 B

  1. "use server";
  2. import { serverFetchJson } from "@/app/utils/fetchUtil";
  3. import { BASE_API_URL } from "@/config/api";
  4. import { revalidatePath, revalidateTag } from "next/cache";
  5. import { BomWeightingScoreResult } from ".";
  6. export interface UpdateBomWeightingScoreInputs {
  7. id: number;
  8. name: string;
  9. range: number;
  10. weighting: number;
  11. remarks?: string;
  12. }
  13. export const updateBomWeightingScore = async (data: UpdateBomWeightingScoreInputs) => {
  14. const response = await serverFetchJson<BomWeightingScoreResult>(
  15. `${BASE_API_URL}/bomWeightingScores/${data.id}`,
  16. {
  17. method: "PUT",
  18. body: JSON.stringify(data),
  19. headers: { "Content-Type": "application/json" },
  20. },
  21. );
  22. revalidateTag("bomWeightingScores");
  23. revalidatePath("/(main)/settings/bomWeighting");
  24. return response;
  25. };