roverdevkit / webapp /frontend /src /hooks /use-predict.ts
jjreif's picture
Deploy roverdevkit @ 2676a67
b3d14e3
Raw
History Blame Contribute Delete
522 Bytes
import { useMutation } from "@tanstack/react-query";
import { api } from "@/lib/api";
import type { PredictRequest, PredictResponse } from "@/types/api";
/**
* `POST /predict` mutation. Kept as a mutation rather than a query
* so the user explicitly drives evaluations from the form rather
* than triggering a request on every keystroke.
*/
export function usePredict() {
return useMutation<PredictResponse, Error, PredictRequest>({
mutationKey: ["predict"],
mutationFn: (req) => api.predict(req),
});
}