Fixed infinite loading when there's no comments (#216)

This commit is contained in:
Nadwey 2022-05-01 19:54:20 +02:00 committed by GitHub
parent 7aef474a06
commit b2320d3c9c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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) {