diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/js/infinitescroll.ts | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/static/js/infinitescroll.ts b/static/js/infinitescroll.ts index 8d6a57f..bef477b 100644 --- a/static/js/infinitescroll.ts +++ b/static/js/infinitescroll.ts @@ -12,11 +12,11 @@ function fetch(url, method, callback, fallback) { const http = new XMLHttpRequest(); http.onreadystatechange = function () { - if (callback && http.readyState === 4 && http.status === 200) { - callback(http); + if (callback && http.readyState === 4) { + if (http.status === 200) callback(http); + else fallback(http); } }; - http.addEventListener("error", fallback); http.open(method, url); http.send(); return http; @@ -66,8 +66,8 @@ console.log("INFO: Fetch", next.href, items); - }, function (event) { - console.warn("WARNING: Switching to native pagination", event); + }, function (http) { + console.warn("WARNING: Switching to native pagination", http); main.insertAdjacentElement("afterend", pagination); abort = true; }); |