Add the route and handler to delete a article.
This commit is contained in:
@@ -98,6 +98,20 @@
|
|||||||
(res/status 500)
|
(res/status 500)
|
||||||
(res/send (ex-message err))))))))
|
(res/send (ex-message err))))))))
|
||||||
|
|
||||||
|
(defn htmx-delete-article-row-handler-factory
|
||||||
|
[client]
|
||||||
|
(fn [req res]
|
||||||
|
(let [channel (chan)
|
||||||
|
id (.-id (.-params req))]
|
||||||
|
(go
|
||||||
|
(try
|
||||||
|
(let [id (<! (db/delete-article client id channel))]
|
||||||
|
(res/status 200)
|
||||||
|
(.send res ""))
|
||||||
|
(catch js/Error err
|
||||||
|
(res/status 500)
|
||||||
|
(res/send (ex-message err))))))))
|
||||||
|
|
||||||
(defn htmx-create-article-handler-factory
|
(defn htmx-create-article-handler-factory
|
||||||
[client]
|
[client]
|
||||||
(fn [req res]
|
(fn [req res]
|
||||||
|
|||||||
@@ -53,6 +53,9 @@
|
|||||||
|
|
||||||
(. app get "/htmx/admin/modals/article/content/:id/"
|
(. app get "/htmx/admin/modals/article/content/:id/"
|
||||||
(handlers/htmx-get-article-preview-content-handler-factory client))
|
(handlers/htmx-get-article-preview-content-handler-factory client))
|
||||||
|
|
||||||
|
(. app delete "/htmx/admin/rows/article/:id/"
|
||||||
|
(handlers/htmx-delete-article-row-handler-factory client))
|
||||||
)
|
)
|
||||||
|
|
||||||
(defn start
|
(defn start
|
||||||
|
|||||||
Reference in New Issue
Block a user