Skip to content

Commit 5d98c46

Browse files
authored
Update script.js
1 parent dc418e3 commit 5d98c46

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

script.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,21 @@ form.addEventListener("submit", async (e) => {
1111
input.value = "";
1212

1313
try {
14-
const response = await fetch("https://indicatiehulp-fn-py.azurewebsites.net/api/chatproxy", {
14+
const response = await fetch("https://chatproxy.azurewebsites.net/api/chatproxy", {
1515
method: "POST",
1616
headers: { "Content-Type": "application/json" },
1717
body: JSON.stringify({ message })
1818
});
1919

20+
if (!response.ok) {
21+
throw new Error(`Serverfout (${response.status})`);
22+
}
23+
2024
const result = await response.json();
2125
appendMessage("Agent", result.tool_output || "Geen antwoord ontvangen.");
2226
} catch (err) {
2327
appendMessage("Agent", "Er ging iets mis.");
24-
console.error(err);
28+
console.error("Fout in webchat:", err);
2529
}
2630
});
2731

0 commit comments

Comments
 (0)