             [tictag.schemas :as schemas]
             [goog.net.cookies]))
 
+(def interceptors [(when ^boolean goog.DEBUG re-frame.core/debug)])
+
 (defn authenticated-xhrio [m token]
   (merge m {:headers {"Authorization" token}}))
 
 (reg-event-fx
  :login/submit-login
+ [interceptors]
  (fn [{:keys [db]} [_ params]]
    ;; TODO edit DB to say we're pending login and add UI
    {:http-xhrio {:method          :post


(reg-event-fx
 :redirect-to-page
 (fn [_ [_ page]]
   {:pushy-replace-token! page}))

(reg-event-fx
 :save-goal
 (fn [{:keys [db]} [_ goal]]
   (let [[errs? params](schemas/validate goal schemas/+goal-schema+)]
     (js/console.log errs? params)
     (if-not errs?
       {:db         db
        :http-xhrio (authenticated-xhrio {:method          (if (:id goal) :put :post)

                                          :on-failure      [:bad-goal-update-result]}
                                         (:auth-token db))}
       {}))))

(reg-event-db
 :good-goal-update-result
 [interceptors]
 (fn [db [_ goal]]
   db))
