This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-08-12
Channels
- # announcements (10)
- # babashka (26)
- # beginners (113)
- # calva (75)
- # cider (7)
- # clj-http (1)
- # cljdoc (2)
- # cljfx (3)
- # cljs-dev (13)
- # clojure (79)
- # clojure-europe (21)
- # clojure-losangeles (2)
- # clojure-nl (4)
- # clojure-sweden (1)
- # clojure-uk (23)
- # clojureladies (4)
- # clojurescript (26)
- # clojureverse-ops (2)
- # conjure (2)
- # cursive (2)
- # data-science (1)
- # datalog (6)
- # datomic (1)
- # degree9 (2)
- # depstar (4)
- # esprit (3)
- # fulcro (25)
- # introduce-yourself (2)
- # jobs (3)
- # lsp (30)
- # meander (38)
- # missionary (9)
- # nbb (7)
- # news-and-articles (2)
- # off-topic (28)
- # pathom (46)
- # polylith (19)
- # re-frame (4)
- # reitit (2)
- # sci (8)
- # shadow-cljs (23)
- # specter (17)
- # spire (1)
- # tools-deps (16)
- # unrepl (1)
- # xtdb (30)
we use our own lib for CSRF, but the usage would be similar https://github.com/leihs/leihs-borrow/blob/8330d7171b3aac3b38e49d4840bae6440f126745/src/client/leihs/borrow/components.cljs#L84-L85 looking at https://ring-clojure.github.io/ring-anti-forgery/ring.util.anti-forgery.html, it seems to be as simple as
[:form {:action "/sign-out" :method "POST"}
[anti-forgery-field]
[:button {:type "submit"} "sign out"]]
👍 3
for AJAX, there does not seems to a helper included, but you just need to include a header to whatever you use to make requests:
(def headers {"X-CSRF-Token" (force *anti-forgery-token*))
in our case: https://github.com/leihs/leihs-borrow/blob/9b6fdb61181c376ba4a103e7214907bcfccff7da/src/client/leihs/borrow/lib/re_graph.cljs#L8