mirror of
https://github.com/penpot/penpot.git
synced 2025-06-02 20:31:39 +02:00
♻️ Simplify internal implementation of sm/schema namespace
This commit is contained in:
parent
b882b9e283
commit
9e94cf7b99
3 changed files with 41 additions and 91 deletions
|
@ -282,9 +282,17 @@
|
|||
[:map {:title "params"}
|
||||
[:session-id ::sm/uuid]])
|
||||
|
||||
(def ^:private decode-params
|
||||
(sm/decoder schema:params sm/json-transformer))
|
||||
|
||||
(def ^:private validate-params!
|
||||
(sm/validate-fn schema:params))
|
||||
|
||||
(defn- http-handler
|
||||
[cfg {:keys [params ::session/profile-id] :as request}]
|
||||
(let [{:keys [session-id]} (sm/conform! schema:params params)]
|
||||
(let [{:keys [session-id]} (-> params
|
||||
decode-params
|
||||
validate-params!)]
|
||||
(cond
|
||||
(not profile-id)
|
||||
(ex/raise :type :authentication
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue