1 parent 0c8669d commit 694dc22Copy full SHA for 694dc22
2 files changed
client/src/utils/aiUtils.js
@@ -15,10 +15,10 @@ export async function post(path, body) {
15
body: JSON.stringify(body),
16
});
17
if (!res.ok) {
18
- const err = await res
19
- .json()
20
- .catch(() => ({ detail: `HTTP ${res.status}` }));
21
- throw new Error(err.detail || `HTTP ${res.status}`);
+ const err = await res.json().catch(() => ({ error: `HTTP ${res.status}` }));
+ throw new Error(
+ err.error || err.detail || err.message || `HTTP ${res.status}`,
+ );
22
}
23
return res.json();
24
client/src/utils/api.js
@@ -1,5 +1,5 @@
1
export const API_URL = import.meta.env.VITE_API_URL || "";
2
3
export function apiFetch(path, options = {}) {
4
- return fetch(`${API_URL}${path}`, options);
+ return fetch(`${API_URL}${path}`, { credentials: "include", ...options });
5
0 commit comments