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

export function getSettings() {
	return queryOptions({
		queryKey: ["getSettings"],
		queryFn: () => fetchSession(),
		staleTime: 5000,
		refetchOnWindowFocus: true,
		placeholderData: keepPreviousData,
	});
}

const fetchSession = async () => {
	const { data } = await axios.get("/lst/api/system/settings");

	return data.data;
};
