Show errors

This commit is contained in:
Simon Brooke 2019-02-18 08:38:56 +00:00
parent 72458e5810
commit 9ec247fe59
2 changed files with 8 additions and 3 deletions

View file

@ -46,14 +46,16 @@
:format (ajax/json-request-format)
:response-format (ajax/json-response-format)
:on-success [:set-transcription]
:on-failure [:bad-transcription]}})))
:on-failure [:bad-transcription]}
:db (dissoc (dissoc db :transcription) :common/error)})))
(rf/reg-event-fx
:bad-transcription
(fn
[{db :db} [_ response]]
;; TODO: signal something has failed? It doesn't matter very much, unless it keeps failing.
(js/console.log (str "Failed to fetch transcription data" response))))
(js/console.log (str "Failed to fetch transcription data" response))
(assoc db :common/error response)))
(rf/reg-event-db
:common/set-error

View file

@ -30,5 +30,8 @@
[b/Row]
[b/Row
[:div.col-sm-12
[b/Alert {:color "success"} @(rf/subscribe [:transcription])]]]]])
[b/Alert {:color "success"} @(rf/subscribe [:transcription])]]]
[b/Row
[:div.col-sm-12
[b/Alert {:color "warning"} @(rf/subscribe [:common/error])]]]]])