mirror of
https://github.com/penpot/penpot.git
synced 2025-01-23 23:18:48 -05:00
Merge pull request #4288 from penpot/superalex-fix-error-update-email
🐛 Fix error when update email
This commit is contained in:
commit
fe3c68ec39
1 changed files with 2 additions and 3 deletions
|
@ -39,8 +39,8 @@
|
||||||
(s/keys :req-un [::email-1 ::email-2]))
|
(s/keys :req-un [::email-1 ::email-2]))
|
||||||
|
|
||||||
(defn- on-error
|
(defn- on-error
|
||||||
[form {:keys [code] :as error}]
|
[form error]
|
||||||
(case code
|
(case (:code (ex-data error))
|
||||||
:email-already-exists
|
:email-already-exists
|
||||||
(swap! form (fn [data]
|
(swap! form (fn [data]
|
||||||
(let [error {:message (tr "errors.email-already-exists")}]
|
(let [error {:message (tr "errors.email-already-exists")}]
|
||||||
|
@ -93,7 +93,6 @@
|
||||||
(let [different-emails-error? (= (dma/get-in @form [:errors :email-2 :code]) :different-emails)
|
(let [different-emails-error? (= (dma/get-in @form [:errors :email-2 :code]) :different-emails)
|
||||||
email-1 (dma/get-in @form [:clean-data :email-1])
|
email-1 (dma/get-in @form [:clean-data :email-1])
|
||||||
email-2 (dma/get-in @form [:clean-data :email-2])]
|
email-2 (dma/get-in @form [:clean-data :email-2])]
|
||||||
(println "different-emails-error?" (and different-emails-error? (= email-1 email-2)))
|
|
||||||
(when (and different-emails-error? (= email-1 email-2))
|
(when (and different-emails-error? (= email-1 email-2))
|
||||||
(swap! form d/dissoc-in [:errors :email-2])))))]
|
(swap! form d/dissoc-in [:errors :email-2])))))]
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue