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

const accessAvailableEndpoint = `${baseUrl}/access/endpoint/available`;

async function retrieveAvailableEndpoint(payload: string) {
  const tokenResponse: any = await fetchDataWithToken(
    accessAvailableEndpoint,
    {
      endpoint: payload,
    },
    "POST",
    false
  );
  if (tokenResponse.status === 200) {
    return true;
  }
  return false;
}

export { retrieveAvailableEndpoint };
