chatbot-mini / services /useApiService.ts
matt HOFFNER
more mini
2670b73
raw
history blame contribute delete
611 Bytes
import { useCallback } from 'react';
import { useFetch } from '@/hooks/useFetch';
export interface GetModelsRequestProps {
key: string;
}
const useApiService = () => {
const fetchService = useFetch();
const getModels = useCallback(
(params: GetModelsRequestProps, signal?: AbortSignal) => {
return fetchService.post<GetModelsRequestProps>(`/api/models`, {
body: { key: params.key },
headers: {
'Content-Type': 'application/json',
},
signal,
});
},
[fetchService],
);
return {
getModels,
};
};
export default useApiService;