fix: check local scenes for installed status
This commit is contained in:
@@ -36,8 +36,16 @@ const PageMarket = {
|
|||||||
const items = data.items || [];
|
const items = data.items || [];
|
||||||
|
|
||||||
let localIds = [];
|
let localIds = [];
|
||||||
let localNames = [];
|
try {
|
||||||
try { const lr = await fetch('/api/dashboards?category=all'); const ld = await lr.json(); if (Array.isArray(ld)) { localIds = ld.map(d => d.id); localNames = ld.map(d => d.name); } } catch(e) {}
|
const lr = await fetch('/api/dashboards?category=all');
|
||||||
|
const ld = await lr.json();
|
||||||
|
if (Array.isArray(ld)) localIds = ld.map(d => d.id);
|
||||||
|
if (isScene) {
|
||||||
|
const sr = await fetch('/api/scenes');
|
||||||
|
const sl = await sr.json();
|
||||||
|
if (Array.isArray(sl)) localIds = localIds.concat(sl.map(s => s.id));
|
||||||
|
}
|
||||||
|
} catch(e) {}
|
||||||
|
|
||||||
if (!items.length) { grid.innerHTML = this._emptyHtml(isScene ? '暂无场景' : '暂无仪表盘'); return; }
|
if (!items.length) { grid.innerHTML = this._emptyHtml(isScene ? '暂无场景' : '暂无仪表盘'); return; }
|
||||||
grid.innerHTML = items.map(d => {
|
grid.innerHTML = items.map(d => {
|
||||||
|
|||||||
Reference in New Issue
Block a user