|
-
- "use server"
-
- import { serverFetchJson } from "@/app/utils/fetchUtil";
- import { BASE_API_URL } from "@/config/api";
- import { cache } from "react";
-
- export interface CreateSkillInputs {
- id?: number;
- name: String;
- code: String;
- description: String;
- }
-
- export interface comboProp {
- id: any;
- label: string;
- }
-
- export interface combo {
- records: comboProp[];
- }
-
- export const fetchSkillCombo = cache(async () => {
- return serverFetchJson<combo>(`${BASE_API_URL}/skill/combo`, {
- next: { tags: ["skill"] },
- });
- });
-
-
- export const saveSkill = async (data: CreateSkillInputs) => {
- return serverFetchJson(`${BASE_API_URL}/skill/save`, {
- method: "POST",
- body: JSON.stringify(data),
- headers: { "Content-Type": "application/json" },
- });
- };
|