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:
parent
433d4fe7ee
commit
5ebe483f8a
1 changed files with 9 additions and 13 deletions
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue