                                     (:registered current-repo) 
                                     [:registered]
                                     [:unregistered])})]
-        (merge {:mutable mutable
-                :state-cursor (:state (om/root-cursor mutable))} state)))   
+        (merge state {:mutable mutable
+                      :state-cursor (:state (om/root-cursor mutable))})))   
 
     om/IRenderState
     (render-state [this state]
-      (let [cursor (:state-cursor state)
-            current-state (nth (om/observe owner (:state-cursor state)) 0)
+      (let [cursor (om/ref-cursor (:state-cursor state))   
+            current-state (nth (om/observe owner cursor) 0)
             auth-token (:auth state)
-            register-repo-url (format "/api/user/%s/register" (get-in state [:repo :name]))
+            register-repo-url (str/format "/api/user/%s/register" (get-in state [:repo "name"]))
             register-fn (fn [] 
-                          (when (= current-state :unregistered)              
+                          (when (= current-state :unregistered)
+                            (om/update! cursor [0] :registering)  
+
                             (go (let [resp (<! (http/post register-repo-url {:oauth-token auth-token
                                                                              :json-params {}}))]
                                    (if (= 200 (:status resp))
-                                     ;; refresh repo state
-                                     ;; TODO
-                                     (om/update! cursor [0] :registered))))))]
+                                     (prn resp)  
+                                     (om/update! cursor [0] :unregistered))))))]
 
         (case current-state
           :registered (dom/h2 nil (get (:repo state) "full_name"))

(ns cloc-webapp.dash
  (:require-macros [cljs.core.async.macros :refer [go alt!]])
  (:require [goog.json :as json]
            [om.core :as om :include-macros true]
            [om.dom :as dom :include-macros true]
            [cljs-http.client :as http])

        (map-indexed repo-button state)))))  

;; {:auth - :repo -}
(defn repo-config-panel [state owner]
  (reify
    om/IInitState
    (init-state [_]
