From aaefe16823507544616bcefa392d126fbcc87822 Mon Sep 17 00:00:00 2001 From: Nadwey <81181783+Nadwey@users.noreply.github.com> Date: Sun, 1 May 2022 11:43:17 +0200 Subject: [PATCH] Fixed infinite loading when there's no comments --- html/comments.html | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/html/comments.html b/html/comments.html index 0b87550..bd037e3 100644 --- a/html/comments.html +++ b/html/comments.html @@ -228,7 +228,10 @@ else { } if (!noCache && commentCache[page]) addComments(commentCache[page]) -fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID}?count=${compact && !auto ? 20 : 10}&page=${page}${history ? "&type=commentHistory" : ""}&${mode}`).then(res => res.json()).then(addComments) +fetch(`../api${!history ? window.location.pathname : "/comments/" + lvl.playerID}?count=${compact && !auto ? 20 : 10}&page=${page}${history ? "&type=commentHistory" : ""}&${mode}`).then((res) => { + if (res.status === 204) return []; + return res.json(); +}).then(addComments) function addComments(res) { -- 2.48.1