mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 12:15:54 +02:00
🐛 Fix unauthorized error handling on viewer with token.
This commit is contained in:
parent
a976a826a5
commit
420d98c0f9
2 changed files with 19 additions and 3 deletions
|
@ -136,12 +136,18 @@
|
||||||
(->> data
|
(->> data
|
||||||
(filter #(= page-id (:page-id %)))
|
(filter #(= page-id (:page-id %)))
|
||||||
(d/index-by :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/reify ::fetch-comment-threads
|
||||||
ptk/WatchEvent
|
ptk/WatchEvent
|
||||||
(watch [_ state stream]
|
(watch [_ state stream]
|
||||||
(->> (rp/query :comment-threads {:file-id file-id})
|
(->> (rp/query :comment-threads {:file-id file-id})
|
||||||
(rx/map #(partial fetched %)))))))
|
(rx/map #(partial fetched %))
|
||||||
|
(rx/catch on-error))))))
|
||||||
|
|
||||||
(defn refresh-comment-thread
|
(defn refresh-comment-thread
|
||||||
[{:keys [id file-id] :as thread}]
|
[{:keys [id file-id] :as thread}]
|
||||||
|
|
|
@ -192,6 +192,16 @@
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(st/emitf dv/toggle-thumbnails-panel))
|
(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
|
on-edit
|
||||||
(mf/use-callback
|
(mf/use-callback
|
||||||
(mf/deps project-id file-id page-id)
|
(mf/deps project-id file-id page-id)
|
||||||
|
@ -220,7 +230,7 @@
|
||||||
|
|
||||||
[:header.viewer-header
|
[:header.viewer-header
|
||||||
[:div.main-icon
|
[: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")
|
[:div.sitemap-zone {:alt (t locale "viewer.header.sitemap")
|
||||||
:on-click on-click}
|
:on-click on-click}
|
||||||
|
|
Loading…
Add table
Reference in a new issue