mirror of
https://github.com/penpot/penpot.git
synced 2026-09-06 12:09:24 +00:00
Simplified login event.
This commit is contained in:
parent
6eb65bfe39
commit
c8d48d4667
@ -28,7 +28,8 @@
|
|||||||
|
|
||||||
rs/WatchEvent
|
rs/WatchEvent
|
||||||
(-apply-watch [this state s]
|
(-apply-watch [this state s]
|
||||||
(rx/of (r/navigate :dashboard/projects)))
|
(rx/of (udu/fetch-profile)
|
||||||
|
(r/navigate :dashboard/projects)))
|
||||||
|
|
||||||
rs/EffectEvent
|
rs/EffectEvent
|
||||||
(-apply-effect [this state]
|
(-apply-effect [this state]
|
||||||
@ -53,13 +54,12 @@
|
|||||||
(-apply-watch [this state s]
|
(-apply-watch [this state s]
|
||||||
(let [params {:username username
|
(let [params {:username username
|
||||||
:password password
|
:password password
|
||||||
:scope "webapp"}]
|
:scope "webapp"}
|
||||||
|
on-error #(udm/error (tr "errors.auth.unauthorized"))]
|
||||||
(->> (rp/req :fetch/token params)
|
(->> (rp/req :fetch/token params)
|
||||||
(rx/map :payload)
|
(rx/map :payload)
|
||||||
(rx/mapcat #(rx/of (logged-in %)
|
(rx/map logged-in)
|
||||||
(udp/fetch-projects)
|
(rx/catch rp/client-error? on-error)))))
|
||||||
(udu/fetch-profile)))
|
|
||||||
(rx/catch rp/client-error? #(udm/error (tr "errors.auth.unauthorized")))))))
|
|
||||||
|
|
||||||
(defn login
|
(defn login
|
||||||
[params]
|
[params]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user