Fix template loading state stuck on 'Loading templates...'
This commit is contained in:
parent
fb329727d2
commit
85510a7647
1 changed files with 9 additions and 5 deletions
|
|
@ -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;
|
||||
this.renderTemplateLibrary();
|
||||
}
|
||||
// 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();
|
||||
}
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue