0
Fork 0
mirror of https://github.com/penpot/penpot.git synced 2025-02-10 09:08:31 -05:00

🐛 Fix unauthorized error handling on viewer with token.

This commit is contained in:
Andrey Antukh 2020-11-27 13:29:35 +01:00
parent a976a826a5
commit 420d98c0f9
2 changed files with 19 additions and 3 deletions

View file

@ -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}]

View file

@ -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}