diff --git a/client/src/utils/aiUtils.js b/client/src/utils/aiUtils.js index d19430f..d2c5c2f 100644 --- a/client/src/utils/aiUtils.js +++ b/client/src/utils/aiUtils.js @@ -15,10 +15,10 @@ export async function post(path, body) { body: JSON.stringify(body), }); if (!res.ok) { - const err = await res - .json() - .catch(() => ({ detail: `HTTP ${res.status}` })); - 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}`, + ); } return res.json(); } diff --git a/client/src/utils/api.js b/client/src/utils/api.js index 79331cf..096ab22 100644 --- a/client/src/utils/api.js +++ b/client/src/utils/api.js @@ -1,5 +1,5 @@ export const API_URL = import.meta.env.VITE_API_URL || ""; export function apiFetch(path, options = {}) { - return fetch(`${API_URL}${path}`, options); + return fetch(`${API_URL}${path}`, { credentials: "include", ...options }); }