20 lines
528 B
TypeScript
20 lines
528 B
TypeScript
|
|
import { useQuery } from "@tanstack/react-query";
|
||
|
|
import { CAMBASE } from "../../../utils/config";
|
||
|
|
|
||
|
|
const fetchCustomFields = async () => {
|
||
|
|
const response = await fetch(`${CAMBASE}/api/fetch-config?id=SightingAmmend0-custom-fields`);
|
||
|
|
if (!response.ok) {
|
||
|
|
throw new Error("Network response was not ok");
|
||
|
|
}
|
||
|
|
return response.json();
|
||
|
|
};
|
||
|
|
|
||
|
|
export const useCustomFields = () => {
|
||
|
|
const customFieldsQuery = useQuery({
|
||
|
|
queryKey: ["customFields"],
|
||
|
|
queryFn: fetchCustomFields,
|
||
|
|
});
|
||
|
|
|
||
|
|
return { customFieldsQuery };
|
||
|
|
};
|