added and error check when fetching Mastodon timeline
This commit is contained in:
parent
0fb72210ac
commit
9a97681a3c
1 changed files with 5 additions and 1 deletions
|
@ -119,7 +119,11 @@
|
||||||
(post-status status-text (not-empty ids)))))
|
(post-status status-text (not-empty ids)))))
|
||||||
|
|
||||||
(defn get-mastodon-timeline [callback]
|
(defn get-mastodon-timeline [callback]
|
||||||
(.then (.get mastodon-client "timelines/home" #js {}) #(-> % .-data js->edn callback)))
|
(.then (.get mastodon-client "timelines/home" #js {})
|
||||||
|
#(let [response (-> % .-data js->edn)]
|
||||||
|
(if-let [error (:error response)]
|
||||||
|
(exit-with-error error)
|
||||||
|
(callback response)))))
|
||||||
|
|
||||||
(defn post-items [last-post-time items]
|
(defn post-items [last-post-time items]
|
||||||
(doseq [{:keys [text media-links]} (->> items
|
(doseq [{:keys [text media-links]} (->> items
|
||||||
|
|
Reference in a new issue