'use server' import { serverFetchJson } from "@/app/utils/fetchUtil"; import { Machine, Operator } from "."; import { BASE_API_URL } from "@/config/api"; import { revalidateTag } from "next/cache"; export interface IsOperatorExistResponse { id: number | null; name: string; code: string; type?: string message: string | null; errorPosition: string | keyof T; entity: T } export interface isCorrectMachineUsedResponse { id: number | null; name: string; code: string; type?: string message: string | null; errorPosition: string | keyof T; entity: T } export const isOperatorExist = async (username: string) => { const isExist = await serverFetchJson>(`${BASE_API_URL}/jop/isOperatorExist`, { method: "POST", body: JSON.stringify({ username }), headers: { "Content-Type": "application/json" }, }); revalidateTag("po"); return isExist } export const isCorrectMachineUsed = async (machineCode: string) => { const isExist = await serverFetchJson>(`${BASE_API_URL}/jop/isCorrectMachineUsed`, { method: "POST", body: JSON.stringify({ machineCode }), headers: { "Content-Type": "application/json" }, }); revalidateTag("po"); return isExist }