       (log (str "Sent to Tango Backend => " remote))
       (chsk-send! [:event-manager/query [[:competition/name :competition/location]]]))))
 
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Application
+
 ;; TODO - since conn is set the read query will be run twice at start up - delay read or something.. 
 (def reconciler
   (om/reconciler
     {:state conn
      :remotes [:remote]
      :parser (om/parser {:read read :mutate mutate})
-     :send (sente-post) ;(fn [x y] (log (str "Sending to server: x" x " y: " y)))
+     :send sente-post ;(fn [x y] (log (str "Sending to server: x" x " y: " y)))
      }))
 
 ;; (om/add-root! reconciler

  (render
   [this]
   (dom/div nil (dom/button #js {:onClick #(log "T'vlingar")} "Tävlingar")
            (dom/div nil ((om/factory CompetitionsView))))))


(defn transit-post [url]
  (fn [{:keys [remote]} cb]

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Server message handling

(declare reconciler)
(defn handle-query-result [d]
  (let [clean-data (uidb/sanitize d)]
    (log "Handle Q R")
     ;(log clean-data)   
    ;(log (apply str (map :competition/name clean-data)))
                                        ;(d/transact! (d/db conn) )
    ;;(d/transact! conn [clean-data])
    ;; (log (d/q '[:find [(pull ?c [:class/name]) ...]
    ;;             :where
    ;;             [?e :competition/name "Rikstävling disco"]
    ;;             [?e :competition/classes ?c]]
    ;;           (d/db conn)))
    ;(d/transact! conn [{:db/id 1 :competition/name (apply str (map :competition/name clean-data))}])
    ;(om/transact! reconciler `[(app/add-competition `{:X "X"}) :app/competitions])
    ;(log clean-data)
    (om/transact! reconciler `[(app/add-competition ~clean-data) :app/competitions
                               ])
    ))

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
