🐛 Show proper 404 when look on not-existing page on viewer.

This commit is contained in:
Andrey Antukh 2021-10-06 14:14:40 +02:00 committed by Andrés Moya
parent 9ecbddc18c
commit f3bb5c55f5
2 changed files with 19 additions and 13 deletions

View file

@ -6,6 +6,7 @@
(ns app.main.ui.viewer
(:require
[app.common.exceptions :as ex]
[app.common.geom.point :as gpt]
[app.main.data.comments :as dcm]
[app.main.data.viewer :as dv]
@ -38,14 +39,10 @@
[{:keys [params data]}]
(let [{:keys [page-id section index]} params
{:keys [file users project perms]} data
local (mf/deref refs/viewer-local)
file (:file data)
users (:users data)
project (:project data)
perms (:permissions data)
page-id (or page-id (-> file :data :pages first))
page (mf/use-memo
@ -78,6 +75,9 @@
(hooks/use-shortcuts ::viewer sc/shortcuts)
(when (nil? page)
(ex/raise :type :not-found))
;; Set the page title
(mf/use-effect
(mf/deps (:name file))