0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-03-20 03:31:24 -05:00

Use deftype for user data events.

This commit is contained in:
Andrey Antukh 2017-01-16 17:49:29 +01:00
parent e3f58f6823
commit 92fc9c1ca6
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -20,7 +20,7 @@
;; --- Profile Fetched
(defrecord ProfileFetched [data]
(deftype ProfileFetched [data]
ptk/UpdateEvent
(update [this state]
(assoc state :profile data)))
@ -31,7 +31,7 @@
;; --- Fetch Profile
(defrecord FetchProfile []
(deftype FetchProfile []
ptk/WatchEvent
(watch [_ state s]
(->> (rp/req :fetch/profile)
@ -44,7 +44,7 @@
;; --- Profile Updated
(defrecord ProfileUpdated [data]
(deftype ProfileUpdated [data]
ptk/WatchEvent
(watch [_ state s]
(rx/of (profile-fetched data)
@ -56,7 +56,7 @@
;; --- Update Profile
(defrecord UpdateProfile [data on-success on-error]
(deftype UpdateProfile [data on-success on-error]
ptk/WatchEvent
(watch [_ state s]
(letfn [(handle-error [{payload :payload}]
@ -80,7 +80,7 @@
;; --- Password Updated
(defrecord PasswordUpdated []
(deftype PasswordUpdated []
ptk/WatchEvent
(watch [_ state stream]
(rx/of (uum/info (tr "settings.password-saved")))))
@ -91,7 +91,7 @@
;; --- Update Password (Form)
(defrecord UpdatePassword [data]
(deftype UpdatePassword [data]
ptk/WatchEvent
(watch [_ state s]
(let [params {:old-password (:old-password data)
@ -113,7 +113,7 @@
;; --- Update Photo
(defrecord UpdatePhoto [file done]
(deftype UpdatePhoto [file done]
ptk/WatchEvent
(watch [_ state stream]
(->> (rp/req :update/profile-photo {:file file})