Improve error handling in VideoList

This commit is contained in:
the1812 2019-08-13 23:10:11 +08:00
parent 6476fc9b12
commit e7379f4607
4 changed files with 9 additions and 8 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1360,11 +1360,12 @@ class VideoList extends NavbarComponent {
return;
}
const json = await Ajax.getJsonWithCredentials(apiUrl);
let videoList = ''
if (json.code !== 0) {
logError(`加载${name}信息失败. 错误码: ${json.code} ${json.message}`);
return;
logError(`加载${name}信息失败. 错误码: ${json.code} ${json.message}`)
} else {
videoList = listMap(json).join("");
}
const videoList = listMap(json).join("");
videoListElement.insertAdjacentHTML("beforeend", videoList + /*html*/`
<li class="more"><a target="_blank" href="${mainUrl}">查看更多</a></li>
`);