debug: loadDevices 加 token 空值检测
This commit is contained in:
@ -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();
|
||||||
|
|||||||
Reference in New Issue
Block a user