The media list API returns { data: { items: [...] } } wrapped format.
Previously only checked data.items which would be undefined.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Logging added at every step:
- handleImageUpload entry
- dimPromise resolution
- thumbPromise resolution
- Upload response status + ok flag + url
- r.json() resolution
- selectMediaItem call
Also: saveField now re-throws after logging so callers know save failed.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
EmDash API wraps success responses as { data: { item: ... } },
not { item: ... }. This was causing "Upload failed: no item returned"
even when the upload actually succeeded.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The error path was throwing at r.json() parsing — r.text() lets us log
the actual raw response before trying to parse it as JSON.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Log response status, raw data, and item count to diagnose
why uploaded images don't appear in media browser grid.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously when the content API returned a non-ok response,
saveField would set error state but still resolve the promise.
This caused downstream code to think save succeeded when it failed.
Now properly extracts error message from response and throws.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>