handle empty download hist stat

This commit is contained in:
Simon 2023-09-02 11:47:07 +07:00
parent 4016e81f9a
commit 8dba2e240e
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

View File

@ -100,6 +100,12 @@ function downloadHist() {
let apiEndpoint = '/api/stats/downloadhist/';
let responseData = apiRequest(apiEndpoint, 'GET');
let histBox = document.getElementById('downHistBox');
if (responseData.length === 0) {
let tile = buildTile('No recent downloads');
histBox.appendChild(tile);
return;
}
for (let i = 0; i < responseData.length; i++) {
const dailyStat = responseData[i];
let tile = buildDailyStat(dailyStat);