diff --git a/src/main/blog/db.cljs b/src/main/blog/db.cljs index 2a63804..c58b0bb 100644 --- a/src/main/blog/db.cljs +++ b/src/main/blog/db.cljs @@ -111,6 +111,22 @@ (catch js/Error err (js/console.log (ex-cause err))))) channel) +(defn update-article + "Update an article and return the id via channel. The timestamp for created will be updated to current timestamp. It gets and returns the same channel." + [client {:keys [id title content]} channel] + (go + (try + (let [res (
js [id title content])))] + (>! channel (-> id))) + (catch js/Error err (js/console.log (ex-cause err))))) + channel) + (defn delete-article "Delete an article and return the id via channel. It gets and returns the same channel." [client id channel]