"use server";
import { fetchData, fetchDataWithToken } from "../api-fetcher";
import { baseUrl, FilterList, FilterListInterface } from "../basics";

const accountsListEndpoint = `${baseUrl}/account/records/list`;

async function retrieveaccountsList(payload: FilterListInterface) {
  const feedObject = new FilterList(payload).filter();
  const tokenResponse: any = await fetchDataWithToken(
    accountsListEndpoint,
    feedObject,
    "POST",
    false
  );
  return tokenResponse;
}

export { retrieveaccountsList };
