diff --git a/frontend/src/app/main/data/auth.cljs b/frontend/src/app/main/data/auth.cljs index ad0b31e1b..9cf2f67c3 100644 --- a/frontend/src/app/main/data/auth.cljs +++ b/frontend/src/app/main/data/auth.cljs @@ -16,6 +16,7 @@ [app.main.repo :as rp] [app.main.store :refer [initial-state]] [app.main.data.users :as du] + [app.main.data.modal :as modal] [app.main.data.messages :as dm] [app.util.router :as rt] [app.util.i18n :as i18n :refer [tr]] @@ -28,13 +29,17 @@ ;; --- Logged In (defn logged-in - [data] + [profile] (ptk/reify ::logged-in ptk/WatchEvent (watch [this state stream] - (let [team-id (:default-team-id data)] - (rx/of (du/profile-fetched data) - (rt/nav :dashboard-team {:team-id team-id})))))) + (let [team-id (:default-team-id profile)] + (rx/merge + (rx/of (du/profile-fetched profile) + (rt/nav :dashboard-projects {:team-id team-id})) + (when-not (get-in profile [:props :onboarding-viewed]) + (->> (rx/of (modal/show {:type :onboarding})) + (rx/delay 1000)))))))) ;; --- Login @@ -60,9 +65,7 @@ (->> (rx/timer 100) (rx/mapcat #(rp/mutation :login params)) (rx/tap on-success) - (rx/catch (fn [err] - (on-error err) - (rx/empty))) + (rx/catch on-error) (rx/map logged-in)))))) (defn login-from-token diff --git a/frontend/src/app/main/ui/dashboard.cljs b/frontend/src/app/main/ui/dashboard.cljs index 6c5350f0c..a85383bc7 100644 --- a/frontend/src/app/main/ui/dashboard.cljs +++ b/frontend/src/app/main/ui/dashboard.cljs @@ -103,11 +103,6 @@ projects (mf/deref projects-ref) project (get projects project-id)] - (mf/use-effect - (fn [] - (when (and profile (not (get-in profile [:props :onboarding-viewed]))) - (st/emit! (modal/show {:type :onboarding}))))) - (mf/use-effect (mf/deps team-id) (st/emitf (dd/fetch-bundle {:id team-id})))