From 94a0c1204901dab93b496df1b92d950c0ba10ef3 Mon Sep 17 00:00:00 2001 From: Alejandro Alonso Date: Tue, 19 Mar 2024 08:22:47 +0100 Subject: [PATCH] :bug: Fix error when update email --- frontend/src/app/main/ui/settings/change_email.cljs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/main/ui/settings/change_email.cljs b/frontend/src/app/main/ui/settings/change_email.cljs index 5543f7d18..daeaf8bf8 100644 --- a/frontend/src/app/main/ui/settings/change_email.cljs +++ b/frontend/src/app/main/ui/settings/change_email.cljs @@ -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])))))]