 
 (s/fdef process-and-set-items-and-bubbles
         :args (s/cat :response ::response))
+
+(s/fdef login-or-add-item
+  :args (s/cat :logged-in? boolean?)
+  :ret ::item)

  (when (lib/logged-in?)
    {"X-Authentication" (lib/clj->json {:type "user" :nickname (lib/get-nickname) :token (lib/get-token)})}))

(defn process-and-set-items-and-bubbles
  "Receive response and prepare UI with the new items and bubbles for the next
  step in the discussion."
  [response]
  (let [{:keys [bubbles attitudes items attacks]} (lib/process-response response)
        update-items (cond
                       (seq items) items
                       (seq attacks) (vals attacks)
                       (seq attitudes) (vals attitudes)
                       :default [])]
    (om/transact! parser/reconciler `[(discussion/bubbles {:value ~bubbles})
                                      (discussion/items {:value ~update-items})])))

;;;; Handlers
(defn error-handler

  "Make ajax call to dialog based argumentation system."
  ([url headers handler params]
   (lib/last-api! url)
   (log/debug "GET Request to:" (make-url url))
   (GET (make-url url)
        {:handler       handler
         :headers       (merge (token-header) headers)
