This is my client side code. I'm using cljs-ajax for POST
(defn persist-state []
(POST "/save" {:params {:state @state}))
Here is my server side code to handle the POST. I'm using compojure.
(POST "/save" req
(let [state (:state (req :params))]
(add-state! state)
{:status 200}))
When I trigger the ajax POST it gives a 403 forbidden error. How do I get around this? Couldn't find anything online to help me.
Edit: My middleware looks like this
(def app
(let [handler (wrap-defaults #'routes site-defaults)]
(if (env :dev) (-> handler wrap-exceptions wrap-reload) handler)))
This was generated from the lein reagent template. I'm fairly certain my problem is related to not setting anti-forgery token.