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