Improve schema_apply error handling and add credentials
- Add better JSON parsing with error logging - Add credentials: same-origin to ensure session cookies are sent - Show helpful error message when server returns invalid response Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1321,9 +1321,18 @@ async function applySchemaUpdates() {
|
||||
"Content-Type": "application/json",
|
||||
"X-CSRF-Token": CSRF_TOKEN
|
||||
},
|
||||
credentials: "same-origin",
|
||||
body: JSON.stringify({ csrf_token: CSRF_TOKEN })
|
||||
});
|
||||
const data = await response.json();
|
||||
|
||||
const text = await response.text();
|
||||
let data;
|
||||
try {
|
||||
data = JSON.parse(text);
|
||||
} catch (parseError) {
|
||||
console.error("Failed to parse response:", text);
|
||||
throw new Error("Server returned invalid response. Check error logs.");
|
||||
}
|
||||
|
||||
if (!data.success) {
|
||||
throw new Error(data.error || "Failed to apply schema changes");
|
||||
|
||||
Reference in New Issue
Block a user