mirror of
https://github.com/penpot/penpot.git
synced 2025-01-24 23:49:45 -05:00
Simplified login event.
This commit is contained in:
parent
6eb65bfe39
commit
c8d48d4667
1 changed files with 6 additions and 6 deletions
|
@ -28,7 +28,8 @@
|
|||
|
||||
rs/WatchEvent
|
||||
(-apply-watch [this state s]
|
||||
(rx/of (r/navigate :dashboard/projects)))
|
||||
(rx/of (udu/fetch-profile)
|
||||
(r/navigate :dashboard/projects)))
|
||||
|
||||
rs/EffectEvent
|
||||
(-apply-effect [this state]
|
||||
|
@ -53,13 +54,12 @@
|
|||
(-apply-watch [this state s]
|
||||
(let [params {:username username
|
||||
:password password
|
||||
:scope "webapp"}]
|
||||
:scope "webapp"}
|
||||
on-error #(udm/error (tr "errors.auth.unauthorized"))]
|
||||
(->> (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")))))))
|
||||
(rx/map logged-in)
|
||||
(rx/catch rp/client-error? on-error)))))
|
||||
|
||||
(defn login
|
||||
[params]
|
||||
|
|
Loading…
Add table
Reference in a new issue