mirror of
https://github.com/penpot/penpot.git
synced 2025-01-25 07:58:49 -05:00
Add support for new profile persistence.
This commit is contained in:
parent
f5d7f0abf4
commit
de2fe77270
1 changed files with 17 additions and 8 deletions
|
@ -6,22 +6,31 @@
|
|||
|
||||
(ns uxbox.repo.users
|
||||
"A main interface for access to remote resources."
|
||||
(:refer-clojure :exclude [do])
|
||||
(:require [beicon.core :as rx]
|
||||
[uxbox.repo.core :refer (request url send!)]
|
||||
[uxbox.state :as ust]))
|
||||
[uxbox.util.transit :as t]))
|
||||
|
||||
(defn- decode-payload
|
||||
[{:keys [payload] :as rsp}]
|
||||
(let [metadata (:metadata payload)]
|
||||
(assoc rsp :payload
|
||||
(assoc payload :metadata (t/decode metadata)))))
|
||||
|
||||
(defmethod request :fetch/profile
|
||||
[type _]
|
||||
(let [url (str url "/profile/me")]
|
||||
(send! {:method :get :url url})))
|
||||
(let [url (str url "/profile/me")
|
||||
params {:method :get :url url}]
|
||||
(->> (send! params)
|
||||
(rx/map decode-payload))))
|
||||
|
||||
(defmethod request :update/profile
|
||||
[type data]
|
||||
(let [params {:url (str url "/profile/me")
|
||||
[type {:keys [metadata id] :as body}]
|
||||
(let [body (assoc body :metadata (t/encode metadata))
|
||||
params {:url (str url "/profile/me")
|
||||
:method :put
|
||||
:body data}]
|
||||
(send! params)))
|
||||
:body body}]
|
||||
(->> (send! params)
|
||||
(rx/map decode-payload))))
|
||||
|
||||
(defmethod request :update/password
|
||||
[type data]
|
||||
|
|
Loading…
Add table
Reference in a new issue