Skip to content

Instantly share code, notes, and snippets.

@kenbier
Last active December 21, 2016 00:50
Show Gist options
  • Save kenbier/8c351564ec807fa36e9cdd153bd21768 to your computer and use it in GitHub Desktop.
Save kenbier/8c351564ec807fa36e9cdd153bd21768 to your computer and use it in GitHub Desktop.
(defonce app (atom nil))
(defn on-app-started [{:keys [networking initial-state] :as app}]
(let [reconciler (:reconciler app)]
(when st/airbrake-client
(.addFilter st/airbrake-client
(fn [notice]
(let [comment (some->> notice
.-errors
first
.-message)]
;; Create new support request on exception.
(om/transact! reconciler
`[(support-request/new
~{:support-id (random-uuid)
:comment comment})]))
notice)))))
(defn network-error-callback [state error status]
(auth/global-error-handler error))
(defn remount-app! []
(if-not @app
(reset! app (uc/new-untangled-client
:request-transform auth/with-auth-token
:initial-state st/init-data
:network-error-callback network-error-callback
:started-callback on-app-started)))
(reset! app (uc/mount @app ui/Root "app")))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment