mirror of
https://github.com/penpot/penpot.git
synced 2025-06-14 08:32:29 +02:00
🐛 Fix unathorized redirect
This commit is contained in:
parent
426758d9b2
commit
ba139d7d2c
2 changed files with 9 additions and 3 deletions
|
@ -53,13 +53,13 @@
|
||||||
|
|
||||||
([id params {:keys [raw-transit?]}]
|
([id params {:keys [raw-transit?]}]
|
||||||
(let [decode-transit (if raw-transit?
|
(let [decode-transit (if raw-transit?
|
||||||
identity
|
http/conditional-error-decode-transit
|
||||||
(partial rx/map http/conditional-decode-transit))]
|
http/conditional-decode-transit)]
|
||||||
(->> (http/send! {:method :get
|
(->> (http/send! {:method :get
|
||||||
:uri (u/join base-uri "api/rpc/query/" (name id))
|
:uri (u/join base-uri "api/rpc/query/" (name id))
|
||||||
:credentials "include"
|
:credentials "include"
|
||||||
:query params})
|
:query params})
|
||||||
(decode-transit)
|
(rx/map decode-transit)
|
||||||
(rx/mapcat handle-response)))))
|
(rx/mapcat handle-response)))))
|
||||||
|
|
||||||
(defn- send-mutation!
|
(defn- send-mutation!
|
||||||
|
|
|
@ -143,6 +143,12 @@
|
||||||
(assoc response :body (t/decode-str body))
|
(assoc response :body (t/decode-str body))
|
||||||
response)))
|
response)))
|
||||||
|
|
||||||
|
(defn conditional-error-decode-transit
|
||||||
|
[{:keys [body status] :as response}]
|
||||||
|
(if (and (>= status 400) (string? body))
|
||||||
|
(assoc response :body (t/decode-str body))
|
||||||
|
response))
|
||||||
|
|
||||||
(defn success?
|
(defn success?
|
||||||
[{:keys [status]}]
|
[{:keys [status]}]
|
||||||
(<= 200 status 299))
|
(<= 200 status 299))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue