api call not going through
Unanswered
Rex posted this in #help-forum
RexOP
here is code
the api call is not working
if i call the api endpoint through a custom function inside the onsubmut function it works and returns teh reponse but i want to make api call through the hook what might be the issue
const {
messages,
setMessages,
input,
handleInputChange,
handleSubmit,
isLoading,
reload,
} = useChat({
api: "/api/chat",
onResponse(response: any) {
console.log("my response use chat:", response);
if (response) {
console.log("we cahet: ", response);
setIsGenerating(false);
}
},
onError(error: any) {
if (error) {
console.log("error: ", error);
setIsGenerating(false);
}
},
});
the api call is not working
if i call the api endpoint through a custom function inside the onsubmut function it works and returns teh reponse but i want to make api call through the hook what might be the issue
4 Replies
RexOP
does this make a post request?