Add debug logging to media browser fetch
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>
This commit is contained in:
@@ -1065,9 +1065,14 @@ export function renderToolbar(config: ToolbarConfig): string {
|
|||||||
|
|
||||||
// Fetch media
|
// Fetch media
|
||||||
ecFetch("/_emdash/api/media?mimeType=image/&limit=30", { credentials: "same-origin" })
|
ecFetch("/_emdash/api/media?mimeType=image/&limit=30", { credentials: "same-origin" })
|
||||||
.then(function(r) { return r.json(); })
|
.then(function(r) {
|
||||||
|
console.log("[emdash] Media fetch response status:", r.status);
|
||||||
|
return r.json();
|
||||||
|
})
|
||||||
.then(function(data) {
|
.then(function(data) {
|
||||||
|
console.log("[emdash] Media fetch data:", JSON.stringify(data));
|
||||||
var items = data.items || [];
|
var items = data.items || [];
|
||||||
|
console.log("[emdash] Items count:", items.length);
|
||||||
var loadingEl = browser.querySelector(".emdash-img-loading");
|
var loadingEl = browser.querySelector(".emdash-img-loading");
|
||||||
if (loadingEl) loadingEl.remove();
|
if (loadingEl) loadingEl.remove();
|
||||||
|
|
||||||
@@ -1081,6 +1086,7 @@ export function renderToolbar(config: ToolbarConfig): string {
|
|||||||
|
|
||||||
var grid = document.createElement("div");
|
var grid = document.createElement("div");
|
||||||
grid.className = "emdash-img-grid";
|
grid.className = "emdash-img-grid";
|
||||||
|
console.log("[emdash] Created grid element, appending", items.length, "items");
|
||||||
|
|
||||||
items.forEach(function(item) {
|
items.forEach(function(item) {
|
||||||
var thumb = document.createElement("div");
|
var thumb = document.createElement("div");
|
||||||
|
|||||||
Reference in New Issue
Block a user