Fixed infinite loading when there's no comments #216

Merged
Nadwey merged 1 commit from master into master 2022-05-01 13:54:20 -04:00

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