"use server";
import { fetchData } from "@/fetchers/fecther";
import { urlTesterList } from "@/fetchers/index";

export const fetchTest = async ({
    page,
    size,
    orderField,
    orderType,
    query,
}: {
    page?: number;
    size?: number;
    orderField?: string[];
    orderType?: string[];
    query?: any;
}) => {
    try {
        const response = await fetchData(urlTesterList, { method: "POST", cache: false, payload: { page, size, orderField, orderType, query } });
        return response.data;
    } catch (error) {
        console.error(error);
        return {
            completed: false,
            data: null,
            message: "No data is found",
        };
    }
};
