import { queryOptions } from "@tanstack/react-query";
import axios from "axios";

export function getOcmeInfo() {
	return queryOptions({
		queryKey: ["ocmeInfo"],
		queryFn: () => fetchSettings(),
		staleTime: 1000,
		refetchInterval: 2 * 2000,
		refetchOnWindowFocus: true,
	});
}

const fetchSettings = async () => {
	const { data } = await axios.get(`/lst/old/ocme/api/v1/getInfo`);
	// if we are not localhost ignore the devDir setting.
	//const url: string = window.location.host.split(":")[0];
	return data.data ?? [];
};
