Last active
December 21, 2016 00:50
-
-
Save kenbier/8c351564ec807fa36e9cdd153bd21768 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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