starchat-ui / services /useApiService.ts
matthoffner's picture
Duplicate from matthoffner/chatbot
13095e0
raw
history blame
1.06 kB
import { useCallback } from 'react';
import { useFetch } from '@/hooks/useFetch';
export interface GetModelsRequestProps {
key: string;
}
const useApiService = () => {
const fetchService = useFetch();
// const getModels = useCallback(
// (
// params: GetManagementRoutineInstanceDetailedParams,
// signal?: AbortSignal
// ) => {
// return fetchService.get<GetManagementRoutineInstanceDetailed>(
// `/v1/ManagementRoutines/${params.managementRoutineId}/instances/${params.instanceId
// }?sensorGroupIds=${params.sensorGroupId ?? ''}`,
// {
// signal,
// }
// );
// },
// [fetchService]
// );
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;