0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-04-15 16:31:25 -05:00

Adjust data profile alias

This commit is contained in:
Andrey Antukh 2024-11-26 20:34:57 +01:00
parent c6b96a81f1
commit f31e2b72e6
2 changed files with 17 additions and 17 deletions

View file

@ -12,7 +12,7 @@
[app.config :as cf]
[app.main.data.auth :as da]
[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.errors]
[app.main.features :as feat]
@ -67,14 +67,14 @@
authenticated user; proceed to fetch teams."
[stream]
(rx/merge
(rx/of (du/fetch-profile))
(rx/of (dp/fetch-profile))
(->> stream
(rx/filter du/profile-fetched?)
(rx/filter dp/profile-fetched?)
(rx/take 1)
(rx/map deref)
(rx/mapcat (fn [profile]
(if (du/is-authenticated? profile)
(rx/of (du/initialize-profile profile))
(if (dp/is-authenticated? profile)
(rx/of (dp/initialize-profile profile))
(rx/empty))))
(rx/observe-on :async))))
@ -95,22 +95,22 @@
;; Watch for profile deletion events
(->> stream
(rx/filter du/profile-deleted?)
(rx/filter dp/profile-deleted?)
(rx/map da/logged-out))
;; Once profile is fetched, initialize all penpot application
;; routes
(->> stream
(rx/filter du/profile-fetched?)
(rx/filter dp/profile-fetched?)
(rx/take 1)
(rx/map #(rt/init-routes)))
;; Once profile fetched and the current user is authenticated,
;; proceed to initialize the websockets connection.
(->> stream
(rx/filter du/profile-fetched?)
(rx/filter dp/profile-fetched?)
(rx/map deref)
(rx/filter du/is-authenticated?)
(rx/filter dp/is-authenticated?)
(rx/take 1)
(rx/map #(ws/initialize)))))))

View file

@ -14,7 +14,7 @@
[app.common.uuid :as uuid]
[app.main.data.event :as ev]
[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.websocket :as ws]
[app.main.repo :as rp]
@ -47,7 +47,7 @@
(if-let [file-id (get props :welcome-file-id)]
(rx/of (rt/nav' :workspace {:project-id (:default-project-id profile)
: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)
team-id (dtm/get-last-team-id)
@ -71,7 +71,7 @@
ptk/WatchEvent
(watch [_ _ stream]
(->> (rx/merge
(rx/of (du/initialize-profile profile)
(rx/of (dp/initialize-profile profile)
(ws/initialize)
(dtm/fetch-teams))
@ -110,9 +110,9 @@
(->> (rp/cmd! :login-with-password (d/without-nils params))
(rx/merge-map (fn [data]
(rx/merge
(rx/of (du/fetch-profile))
(rx/of (dp/fetch-profile))
(->> stream
(rx/filter du/profile-fetched?)
(rx/filter dp/profile-fetched?)
(rx/take 1)
(rx/map deref)
(rx/filter (complement is-authenticated?))
@ -121,7 +121,7 @@
(rx/observe-on :async))
(->> stream
(rx/filter du/profile-fetched?)
(rx/filter dp/profile-fetched?)
(rx/take 1)
(rx/map deref)
(rx/filter is-authenticated?)
@ -179,9 +179,9 @@
ptk/WatchEvent
(watch [_ _ stream]
(rx/merge
(rx/of (du/fetch-profile))
(rx/of (dp/fetch-profile))
(->> stream
(rx/filter du/profile-fetched?)
(rx/filter dp/profile-fetched?)
(rx/take 1)
(rx/map deref)
(rx/filter is-authenticated?)