 (defn references-handler
   "Called when received a response on the reference-query."
   [response]
-  (let [refs  (:references response)
-        error (:error response)]
+  (let [res   (keywordize-keys response)
+        refs  (:references res)
+        csrf  (:csrf res)
+        error (:error res)]
     (if (pos? (count error))
       (lib/error-msg! error)
       (do

(defn error-handler
  "Generic error handler for ajax requests."
  [{:keys [status status-text]}]
  (.log js/console (str "something bad happened: " status " " status-text))
  (lib/error-msg! (str status " " status-text))
  (lib/loading? false))


  ([url body]
   (post-json url body success-handler {"Content-Type" "application/json"})))

(defn request-references
  "When this app is loaded, request all available references from the external discussion system."
  []
  (let [url "api/get/references"                            ; TODO hardcoded url = bad
