Fix pagination direction for "fetch more" button

This commit is contained in:
arne 2025-11-19 19:50:26 +01:00
commit dbe15d9054

View file

@ -387,9 +387,6 @@
(let [defaults {:max-id nil (let [defaults {:max-id nil
:on-response (fn [response] :on-response (fn [response]
(let [url-params (url->search-params (.-url (:raw response)))] (let [url-params (url->search-params (.-url (:raw response)))]
(js/console.log :on-response
:max_id (.get url-params "max_id")
:min_id (.get url-params "min_id"))
(doseq [post (:body response)] (doseq [post (:body response)]
(db/put! ::db/posts (cond-> post (db/put! ::db/posts (cond-> post
; these IDs are internal server ids and it looks like ; these IDs are internal server ids and it looks like
@ -421,11 +418,11 @@
(when min-id (when min-id
(fetch-posts! {:instance-url (:instance_url application) (fetch-posts! {:instance-url (:instance_url application)
:bearer-token (:bearer_token application) :bearer-token (:bearer_token application)
:min-id min-id})) :min-id max-id}))
(when max-id (when max-id
(fetch-posts! {:instance-url (:instance_url application) (fetch-posts! {:instance-url (:instance_url application)
:bearer-token (:bearer_token application) :bearer-token (:bearer_token application)
:max-id max-id})) :max-id min-id}))
(when-not (or min-id max-id) (when-not (or min-id max-id)
(fetch-posts! {:instance-url (:instance_url application) (fetch-posts! {:instance-url (:instance_url application)
:bearer-token (:bearer_token application)})))))) :bearer-token (:bearer_token application)}))))))