diff --git a/frontend/src/app/main/data/viewer.cljs b/frontend/src/app/main/data/viewer.cljs index cf06925ecc..5c63e62eab 100644 --- a/frontend/src/app/main/data/viewer.cljs +++ b/frontend/src/app/main/data/viewer.cljs @@ -136,12 +136,18 @@ (->> data (filter #(= page-id (:page-id %))) (d/index-by :id) - (assoc state :comment-threads)))] + (assoc state :comment-threads))) + (on-error [err] + (if (= :authorization (:type err)) + (rx/empty) + (rx/throw err)))] + (ptk/reify ::fetch-comment-threads ptk/WatchEvent (watch [_ state stream] (->> (rp/query :comment-threads {:file-id file-id}) - (rx/map #(partial fetched %))))))) + (rx/map #(partial fetched %)) + (rx/catch on-error)))))) (defn refresh-comment-thread [{:keys [id file-id] :as thread}] diff --git a/frontend/src/app/main/ui/viewer/header.cljs b/frontend/src/app/main/ui/viewer/header.cljs index f0bd849f36..ae063c32ea 100644 --- a/frontend/src/app/main/ui/viewer/header.cljs +++ b/frontend/src/app/main/ui/viewer/header.cljs @@ -192,6 +192,16 @@ (mf/use-callback (st/emitf dv/toggle-thumbnails-panel)) + on-goback + (mf/use-callback + (mf/deps project-id file-id page-id anonymous?) + (fn [] + (if anonymous? + (st/emit! (rt/nav :login)) + (st/emit! (rt/nav :workspace + {:project-id project-id + :file-id file-id} + {:page-id page-id}))))) on-edit (mf/use-callback (mf/deps project-id file-id page-id) @@ -220,7 +230,7 @@ [:header.viewer-header [:div.main-icon - [:a {:on-click on-edit} i/logo-icon]] + [:a {:on-click on-goback} i/logo-icon]] [:div.sitemap-zone {:alt (t locale "viewer.header.sitemap") :on-click on-click}