0
0

debug: loadDevices 加 token 空值检测

This commit is contained in:
xiaoou
2026-07-10 14:18:00 +08:00
parent e2a04da338
commit 5991fa768c

View File

@ -242,12 +242,9 @@ async function createUser() {
async function loadDevices() { async function loadDevices() {
document.getElementById('sys-status').textContent = '运行中'; document.getElementById('sys-status').textContent = '运行中';
// 实体中文名映射 var names = { 'zone.home': '家庭区域', 'person.admin': '管理员' };
var names = {
'zone.home': '家庭区域',
'person.admin': '管理员',
};
try { try {
if (!token) { document.getElementById('sys-status').textContent = '未登录 (无token)'; return; }
var r = await api('GET', '/api/states'); var r = await api('GET', '/api/states');
if (!r.ok) throw new Error('HTTP ' + r.status + ' ' + r.statusText); if (!r.ok) throw new Error('HTTP ' + r.status + ' ' + r.statusText);
var states = await r.json(); var states = await r.json();