mirror of
https://github.com/penpot/penpot.git
synced 2025-05-15 21:16:37 +02:00
✨ Adjust data profile alias
This commit is contained in:
parent
c6b96a81f1
commit
f31e2b72e6
2 changed files with 17 additions and 17 deletions
|
@ -12,7 +12,7 @@
|
||||||
[app.config :as cf]
|
[app.config :as cf]
|
||||||
[app.main.data.auth :as da]
|
[app.main.data.auth :as da]
|
||||||
[app.main.data.event :as ev]
|
[app.main.data.event :as ev]
|
||||||
[app.main.data.profile :as du]
|
[app.main.data.profile :as dp]
|
||||||
[app.main.data.websocket :as ws]
|
[app.main.data.websocket :as ws]
|
||||||
[app.main.errors]
|
[app.main.errors]
|
||||||
[app.main.features :as feat]
|
[app.main.features :as feat]
|
||||||
|
@ -67,14 +67,14 @@
|
||||||
authenticated user; proceed to fetch teams."
|
authenticated user; proceed to fetch teams."
|
||||||
[stream]
|
[stream]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (du/fetch-profile))
|
(rx/of (dp/fetch-profile))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-fetched?)
|
(rx/filter dp/profile-fetched?)
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map deref)
|
(rx/map deref)
|
||||||
(rx/mapcat (fn [profile]
|
(rx/mapcat (fn [profile]
|
||||||
(if (du/is-authenticated? profile)
|
(if (dp/is-authenticated? profile)
|
||||||
(rx/of (du/initialize-profile profile))
|
(rx/of (dp/initialize-profile profile))
|
||||||
(rx/empty))))
|
(rx/empty))))
|
||||||
(rx/observe-on :async))))
|
(rx/observe-on :async))))
|
||||||
|
|
||||||
|
@ -95,22 +95,22 @@
|
||||||
|
|
||||||
;; Watch for profile deletion events
|
;; Watch for profile deletion events
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-deleted?)
|
(rx/filter dp/profile-deleted?)
|
||||||
(rx/map da/logged-out))
|
(rx/map da/logged-out))
|
||||||
|
|
||||||
;; Once profile is fetched, initialize all penpot application
|
;; Once profile is fetched, initialize all penpot application
|
||||||
;; routes
|
;; routes
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-fetched?)
|
(rx/filter dp/profile-fetched?)
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map #(rt/init-routes)))
|
(rx/map #(rt/init-routes)))
|
||||||
|
|
||||||
;; Once profile fetched and the current user is authenticated,
|
;; Once profile fetched and the current user is authenticated,
|
||||||
;; proceed to initialize the websockets connection.
|
;; proceed to initialize the websockets connection.
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-fetched?)
|
(rx/filter dp/profile-fetched?)
|
||||||
(rx/map deref)
|
(rx/map deref)
|
||||||
(rx/filter du/is-authenticated?)
|
(rx/filter dp/is-authenticated?)
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map #(ws/initialize)))))))
|
(rx/map #(ws/initialize)))))))
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
[app.common.uuid :as uuid]
|
[app.common.uuid :as uuid]
|
||||||
[app.main.data.event :as ev]
|
[app.main.data.event :as ev]
|
||||||
[app.main.data.notifications :as ntf]
|
[app.main.data.notifications :as ntf]
|
||||||
[app.main.data.profile :as du]
|
[app.main.data.profile :as dp]
|
||||||
[app.main.data.team :as dtm]
|
[app.main.data.team :as dtm]
|
||||||
[app.main.data.websocket :as ws]
|
[app.main.data.websocket :as ws]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
|
@ -47,7 +47,7 @@
|
||||||
(if-let [file-id (get props :welcome-file-id)]
|
(if-let [file-id (get props :welcome-file-id)]
|
||||||
(rx/of (rt/nav' :workspace {:project-id (:default-project-id profile)
|
(rx/of (rt/nav' :workspace {:project-id (:default-project-id profile)
|
||||||
:file-id file-id})
|
:file-id file-id})
|
||||||
(du/update-profile-props {:welcome-file-id nil}))
|
(dp/update-profile-props {:welcome-file-id nil}))
|
||||||
|
|
||||||
(let [teams (into #{} (map :id) teams)
|
(let [teams (into #{} (map :id) teams)
|
||||||
team-id (dtm/get-last-team-id)
|
team-id (dtm/get-last-team-id)
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(->> (rx/merge
|
(->> (rx/merge
|
||||||
(rx/of (du/initialize-profile profile)
|
(rx/of (dp/initialize-profile profile)
|
||||||
(ws/initialize)
|
(ws/initialize)
|
||||||
(dtm/fetch-teams))
|
(dtm/fetch-teams))
|
||||||
|
|
||||||
|
@ -110,9 +110,9 @@
|
||||||
(->> (rp/cmd! :login-with-password (d/without-nils params))
|
(->> (rp/cmd! :login-with-password (d/without-nils params))
|
||||||
(rx/merge-map (fn [data]
|
(rx/merge-map (fn [data]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (du/fetch-profile))
|
(rx/of (dp/fetch-profile))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-fetched?)
|
(rx/filter dp/profile-fetched?)
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map deref)
|
(rx/map deref)
|
||||||
(rx/filter (complement is-authenticated?))
|
(rx/filter (complement is-authenticated?))
|
||||||
|
@ -121,7 +121,7 @@
|
||||||
(rx/observe-on :async))
|
(rx/observe-on :async))
|
||||||
|
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-fetched?)
|
(rx/filter dp/profile-fetched?)
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map deref)
|
(rx/map deref)
|
||||||
(rx/filter is-authenticated?)
|
(rx/filter is-authenticated?)
|
||||||
|
@ -179,9 +179,9 @@
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ _ stream]
|
(watch [_ _ stream]
|
||||||
(rx/merge
|
(rx/merge
|
||||||
(rx/of (du/fetch-profile))
|
(rx/of (dp/fetch-profile))
|
||||||
(->> stream
|
(->> stream
|
||||||
(rx/filter du/profile-fetched?)
|
(rx/filter dp/profile-fetched?)
|
||||||
(rx/take 1)
|
(rx/take 1)
|
||||||
(rx/map deref)
|
(rx/map deref)
|
||||||
(rx/filter is-authenticated?)
|
(rx/filter is-authenticated?)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue