diff --git a/src/main/blog/handlers.cljs b/src/main/blog/handlers.cljs index 56080ab..d601435 100644 --- a/src/main/blog/handlers.cljs +++ b/src/main/blog/handlers.cljs @@ -98,3 +98,23 @@ (res/status 500) (res/send (ex-message err)))))))) +(defn htmx-create-article-handler-factory + [client] + (fn [req res] + (let [channel (chan) + title (.-title (.-body req)) + content (.-content (.-body req))] + (go + (try + (let [id ( {:extended false} + (clj->js)))) + (. app get "/" (handlers/index-page-handler-factory client)) (fn [req res] @@ -35,6 +42,9 @@ (. app get "/admin" (handlers/admin-panel-handler-factory client)) + (. app post "/htmx/articles/" + (handlers/htmx-create-article-handler-factory client)) + (. app get "/htmx/articles/:id" (handlers/htmx-get-article-handler-factory client)) diff --git a/views/admin_panel.hbs b/views/admin_panel.hbs index f7d854d..ba6d494 100644 --- a/views/admin_panel.hbs +++ b/views/admin_panel.hbs @@ -34,9 +34,8 @@