0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-11 15:21:18 -05:00

🐛 Fix error handling on account deletion process

This commit is contained in:
Andrey Antukh 2024-06-27 12:13:12 +02:00
parent 7e44ae62a2
commit 2cddbc8a3d
2 changed files with 8 additions and 9 deletions

View file

@ -537,10 +537,8 @@
on-success identity}} (meta params)]
(->> (rp/cmd! :delete-profile {})
(rx/tap on-success)
(rx/delay-at-least 300)
(rx/catch (constantly (rx/of 1)))
(rx/map logged-out)
(rx/catch on-error))))))
(rx/catch on-error)
(rx/delay-at-least 300))))))
;; --- EVENT: request-profile-recovery

View file

@ -18,11 +18,12 @@
[rumext.v2 :as mf]))
(defn on-error
[{:keys [code] :as error}]
(if (= :owner-teams-with-people code)
(let [msg (tr "notifications.profile-deletion-not-allowed")]
(rx/of (msg/error msg)))
(rx/throw error)))
[cause]
(let [code (-> cause ex-data :code)]
(if (= :owner-teams-with-people code)
(let [msg (tr "notifications.profile-deletion-not-allowed")]
(rx/of (msg/error msg)))
(rx/throw cause))))
(mf/defc delete-account-modal
{::mf/register modal/components