0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-01-24 07:29:08 -05:00

Show properly conflict errors on colors page.

This commit is contained in:
Andrey Antukh 2016-11-08 20:41:25 +01:00
parent 5fade8bb93
commit c8683ea0ba
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95
3 changed files with 11 additions and 2 deletions

View file

@ -70,8 +70,11 @@
"errors.form.max-len" "Should be less than %s" "errors.form.max-len" "Should be less than %s"
"errors.form.color" "Should be a valid color string" "errors.form.color" "Should be a valid color string"
"errors.form.password-not-match" "Password does not match" "errors.form.password-not-match" "Password does not match"
"errors.generic" "Something work has happened."
"errors.auth.unauthorized" "Username or passwords seems to be wrong." "errors.auth.unauthorized" "Username or passwords seems to be wrong."
"errors.auth.invalid-recovery-token" "The recovery token is invalid." "errors.auth.invalid-recovery-token" "The recovery token is invalid."
"errors.profile.update-password" "Error updating password, probably your old password is wrong." "errors.profile.update-password" "Error updating password, probably your old password is wrong."
"errors.generic" "Something work has happened."
"errors.conflict" "Conflict on saving data, please refresh and try again."
}) })

View file

@ -50,7 +50,7 @@
(defn- on-error (defn- on-error
"A default error handler." "A default error handler."
[error] [{:keys [status] :as error}]
(cond (cond
;; Unauthorized or Auth timeout ;; Unauthorized or Auth timeout
(and (:status error) (and (:status error)
@ -59,6 +59,10 @@
(= (:status error) 419))) (= (:status error) 419)))
(rs/emit! (dauth/logout)) (rs/emit! (dauth/logout))
;; Conflict
(= status 412)
(dmsg/error! (tr "errors.conflict"))
;; Network error ;; Network error
(= (:status error) 0) (= (:status error) 0)
(do (do

View file

@ -12,6 +12,7 @@
[uxbox.main.data.dashboard :as dd] [uxbox.main.data.dashboard :as dd]
[uxbox.main.data.lightbox :as udl] [uxbox.main.data.lightbox :as udl]
[uxbox.main.state :as st] [uxbox.main.state :as st]
[uxbox.main.ui.messages :as uum]
[uxbox.main.ui.colorpicker :refer (colorpicker)] [uxbox.main.ui.colorpicker :refer (colorpicker)]
[uxbox.main.ui.dashboard.header :refer (header)] [uxbox.main.ui.dashboard.header :refer (header)]
[uxbox.main.ui.forms :as form] [uxbox.main.ui.forms :as form]
@ -330,6 +331,7 @@
colls (mx/react collections-ref) colls (mx/react collections-ref)
coll (get colls (:id state))] coll (get colls (:id state))]
[:main.dashboard-main [:main.dashboard-main
(uum/messages)
(header) (header)
[:section.dashboard-content [:section.dashboard-content
(nav state colls) (nav state colls)