🐛 Properly redirect to login on unauthorized request.

This commit is contained in:
Andrey Antukh 2020-11-23 09:48:09 +01:00 committed by Alonso Torres
parent fa0e0af5b9
commit 420294aef4

View file

@ -33,6 +33,7 @@
[app.main.ui.workspace :as workspace] [app.main.ui.workspace :as workspace]
[app.util.i18n :as i18n :refer [tr t]] [app.util.i18n :as i18n :refer [tr t]]
[app.util.timers :as ts] [app.util.timers :as ts]
[app.util.router :as rt]
[cuerdas.core :as str] [cuerdas.core :as str]
[cljs.spec.alpha :as s] [cljs.spec.alpha :as s]
[expound.alpha :as expound] [expound.alpha :as expound]
@ -222,8 +223,10 @@
(defmethod ptk/handle-error :authorization (defmethod ptk/handle-error :authorization
[error] [error]
(st/emit! (rt/nav :login))
(ts/schedule (ts/schedule
(st/emitf (dm/show {:content "Not authorized to see this content." (st/emitf (dm/show {:content "Not authorized to see this content."
:timeout 5000
:type :error})))) :type :error}))))
(defmethod ptk/handle-error :assertion (defmethod ptk/handle-error :assertion