   [data]
   (let [[errors data] (sc/validate data update-password-schema)]
     (if errors
-      (forms/assign-errors :profile/password errors)
+      (udf/assign-errors :profile/password errors)
       (UpdatePassword. data))))

(defrecord UpdateProfile [data]
  rs/WatchEvent
  (-apply-watch [_ state s]
    (letfn [(on-error [err]
              (uum/error (tr "errors.update-profile"))
              (rx/empty))]
      (->> (rp/req :update/profile data)
           (rx/catch on-error)
           (rx/map :payload)
           (rx/map profile-fetched)))))

(defn update-profile
  [data]


  rs/EffectEvent
  (-apply-effect [_ state]
    (udm/info! (tr "profile.password-saved"))))

;; --- Update Password

(defrecord UpdatePassword [data]
  rs/WatchEvent
  (-apply-watch [_ state s]
    (letfn [(on-error [{payload :payload}]
              (->> (:payload payload)
                   (udf/assign-errors :profile/password)
                   (rx/of)))]
      (let [params {:old-password (:old-password data)
                    :password (:password-1 data)}]
        (->> (rp/req :update/password params)
             (rx/catch rp/client-error? on-error)
             (rx/map #(->PasswordUpdated)))))))

(def ^:private update-password-schema
  [[:password-1 sc/required sc/string [sc/min-len 6]]
   [:password-2 sc/required sc/string
    [sc/identical-to :password-1 :message "errors.form.password-not-match"]]
