Update the index page to save the search in the query parameters.

This commit is contained in:
2024-04-14 21:36:36 +03:00
parent cc3456fa3b
commit dd72f8d489
4 changed files with 18 additions and 5 deletions
+4 -2
View File
@@ -7,10 +7,12 @@
[client]
(fn [req res]
(let [channel (chan)
id (.-id (.-params req))]
search (.-search (.-query req))]
(go
(try
(let [articles (<! (db/get-articles-briefly client channel))]
(let [articles (if (nil? search)
(<! (db/get-articles-briefly client channel))
(<! (db/search-articles-briefly client search channel)))]
(res/status 200)
(.render res "index"
(-> {:articles articles