0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-26 08:45:34 -05:00

Don't fetch profile and projects if authentication is failed.

This commit is contained in:
Andrey Antukh 2016-04-15 23:26:16 +03:00
parent 433d4fe7ee
commit 5ebe483f8a
No known key found for this signature in database
GPG key ID: 4DFEBCB8316A8B95

View file

@ -51,19 +51,15 @@
rs/WatchEvent
(-apply-watch [this state s]
(letfn [(on-error [{:keys [status payload]}]
(println status payload)
(uum/error (tr "errors.auth.unauthorized"))
(rx/empty))]
(let [params {:username username
:password password
:scope "webapp"}]
(->> (rp/req :fetch/token params)
(rx/catch rp/client-error? on-error)
(rx/map :payload)
(rx/mapcat #(rx/of (logged-in %)
(dp/fetch-projects)
(udu/fetch-profile))))))))
(let [params {:username username
:password password
:scope "webapp"}]
(->> (rp/req :fetch/token params)
(rx/map :payload)
(rx/mapcat #(rx/of (logged-in %)
(udp/fetch-projects)
(udu/fetch-profile)))
(rx/catch rp/client-error? #(udm/error (tr "errors.auth.unauthorized")))))))
(defn login
[params]