0
Fork 0
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:
Eva Marco 2024-03-19 09:56:52 +01:00 committed by GitHub
commit fe3c68ec39
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -39,8 +39,8 @@
(s/keys :req-un [::email-1 ::email-2]))
(defn- on-error
[form {:keys [code] :as error}]
(case code
[form error]
(case (:code (ex-data error))
:email-already-exists
(swap! form (fn [data]
(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)
email-1 (dma/get-in @form [:clean-data :email-1])
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))
(swap! form d/dissoc-in [:errors :email-2])))))]