From 0df777ef0a2c9f02316c19195668f331fef961b7 Mon Sep 17 00:00:00 2001 From: AnthonyAxenov Date: Wed, 27 Nov 2024 09:57:27 +0800 Subject: [PATCH] =?UTF-8?q?=D0=A4=D0=B8=D0=BA=D1=81=D1=8B=20=D1=81=D1=82?= =?UTF-8?q?=D0=B0=D1=82=D1=83=D1=81=D0=BE=D0=B2=20=D0=BF=D1=80=D0=BE=D0=B2?= =?UTF-8?q?=D0=B5=D1=80=D0=BA=D0=B8=20=D0=BF=D0=BB=D0=B5=D0=B9=D0=BB=D0=B8?= =?UTF-8?q?=D1=81=D1=82=D0=BE=D0=B2=20=D0=B2=20=D1=81=D0=BF=D0=B8=D1=81?= =?UTF-8?q?=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/views/list.twig | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/views/list.twig b/src/views/list.twig index 93973b4..086dee6 100644 --- a/src/views/list.twig +++ b/src/views/list.twig @@ -22,9 +22,7 @@ {% for id, playlist in playlists %} - - {{ id }} - + {{ id }} loading {{ playlist.name }} @@ -42,8 +40,6 @@ {{ playlist.url }} @@ -84,11 +80,10 @@ let el_count = tr.querySelector('td.count') xhr.onreadystatechange = () => { if (xhr.readyState === XMLHttpRequest.DONE) { - console.log('[' + id + '] DONE', xhr.response) el_status.classList.remove('bg-secondary') - el_status.innerText = xhr.response.status.possibleStatus + el_status.innerText = xhr.response?.status.possibleStatus ?? 'error' el_count.innerText = xhr.response?.content.channelCount ?? 0 - switch (xhr.response.status.possibleStatus) { + switch (el_status.innerText) { case 'online': el_status.classList.add('bg-success') break @@ -99,24 +94,21 @@ el_status.classList.add('bg-danger') break } - if (xhr.response.error) { + if (xhr.response?.error) { el_status.title = '[' + xhr.response.error.code + '] ' + xhr.response.error.message } } } xhr.onerror = () => { - console.log('[' + id + '] ERROR', xhr.response) el_status.classList.add('bg-danger') el_status.innerText = 'error' el_count.innerText = 0 } xhr.onabort = () => { - console.log('[' + id + '] ABORTED', xhr.response) el_status.classList.add('bg-secondary') el_count.innerText = 0 } xhr.ontimeout = () => { - console.log('[' + id + '] TIMEOUT', xhr.response) el_status.classList.add('bg-secondary') el_status.innerText = 'timeout' el_count.innerText = 0