typescriptified and also removed hardcoded addresses

This commit is contained in:
Patrick_Pluto 2024-10-03 14:10:21 +02:00
parent 61919ad094
commit 091744d75b
5 changed files with 42 additions and 18 deletions

View file

@ -5,7 +5,10 @@ export const sendToVoiceRecognition = (audio_data: Blob): Promise<string> => {
const formdata = new FormData()
formdata.append("audio", audio_data)
return axios.post("http://localhost:5000/interstellar_ai/api/voice_recognition", formdata)
const apiURL = new URL("http://localhost:5000/interstellar_ai/api/voice_recognition")
apiURL.hostname = window.location.hostname;
return axios.post(apiURL.href, formdata)
.then((response) => {
return response.data.response
})