fix(export): send credentials and surface server error on USFM export#312
Conversation
useExportUsfm omitted credentials: 'include' — the only API call in the app that did. It worked only because the export endpoint was unauthenticated; once fluent-api requires auth (eten-tech-foundation/fluent-api#189) the request would 401 and the editor export would break. - Add credentials: 'include' so the session cookie is sent. - Parse the JSON error body (supports both { message } and the USFM route's { error } shape) and surface it, so ExportProjectDialog shows the actual reason (e.g. 'Invalid book IDs') instead of a hardcoded 'Export Failed'. Refs eten-tech-foundation/fluent-api#195
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe USFM export hook gains a ChangesUSFM Export Error Handling
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint install failed: dependency version conflict. Check your lock file or package.json. Comment |
Part of eten-tech-foundation/fluent-api#195.
Summary
useExportUsfmwas the only API call in the app that omittedcredentials: 'include'. It worked only because the export endpoint wasunauthenticated; once fluent-api requires auth
(eten-tech-foundation/fluent-api#189), the request would 401 and the editor
export would break.
credentials: 'include'so the session cookie is sent.{ message }envelope and theUSFM route's
{ error }shape) and surface it, soExportProjectDialogshowsthe actual reason (e.g. "Invalid book IDs", "No books available") instead of a
hardcoded "Export Failed". The dialog already had the inline error UI + logging.
This must deploy with or before fluent-api#189's auth change, or the editor
export will 401.
Test plan
pnpm typecheckpnpm lint(changed files)pnpm test— 38/38 passSummary by CodeRabbit
Bug Fixes