Fix template loading state stuck on 'Loading templates...'

This commit is contained in:
John Mizerek 2026-01-14 12:27:40 -08:00
parent fb329727d2
commit 85510a7647

View file

@ -2848,17 +2848,21 @@
if (data.OK && data.MENU) {
this.menu = data.MENU;
console.log('[MenuBuilder] Menu categories:', this.menu.categories?.length || 0);
// Store templates from API
if (data.TEMPLATES) {
this.templates = data.TEMPLATES;
// Store templates from API (default to empty array if not provided)
this.templates = data.TEMPLATES || [];
this.renderTemplateLibrary();
}
this.render();
} else {
console.log('[MenuBuilder] No MENU in response or OK=false');
// Still clear the loading message
this.templates = [];
this.renderTemplateLibrary();
}
} catch (err) {
console.error('[MenuBuilder] Error loading menu:', err);
// Clear loading message on error
this.templates = [];
this.renderTemplateLibrary();
}
},