Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.
 
 

37 rader
784 B

  1. "use server"
  2. import { serverFetchJson } from "@/app/utils/fetchUtil";
  3. import { BASE_API_URL } from "@/config/api";
  4. import { cache } from "react";
  5. export interface CreateSkillInputs {
  6. id?: number;
  7. name: String;
  8. code: String;
  9. description: String;
  10. }
  11. export interface comboProp {
  12. id: any;
  13. label: string;
  14. }
  15. export interface combo {
  16. records: comboProp[];
  17. }
  18. export const fetchSkillCombo = cache(async () => {
  19. return serverFetchJson<combo>(`${BASE_API_URL}/skill/combo`, {
  20. next: { tags: ["skill"] },
  21. });
  22. });
  23. export const saveSkill = async (data: CreateSkillInputs) => {
  24. return serverFetchJson(`${BASE_API_URL}/skill/save`, {
  25. method: "POST",
  26. body: JSON.stringify(data),
  27. headers: { "Content-Type": "application/json" },
  28. });
  29. };