mirror of
https://github.com/penpot/penpot.git
synced 2025-05-05 23:45:53 +02:00
🐛 Fix incorrect redirect handling on request-access go-home button
This commit is contained in:
parent
179d534237
commit
86c5ca4213
8 changed files with 182 additions and 109 deletions
|
@ -143,4 +143,3 @@
|
||||||
(reinit))))
|
(reinit))))
|
||||||
|
|
||||||
(set! (.-stackTraceLimit js/Error) 50)
|
(set! (.-stackTraceLimit js/Error) 50)
|
||||||
|
|
||||||
|
|
|
@ -171,6 +171,7 @@
|
||||||
(let [team-id (get-current-team-id profile)
|
(let [team-id (get-current-team-id profile)
|
||||||
welcome-file-id (dm/get-in profile [:props :welcome-file-id])
|
welcome-file-id (dm/get-in profile [:props :welcome-file-id])
|
||||||
redirect-href (:login-redirect @s/session)]
|
redirect-href (:login-redirect @s/session)]
|
||||||
|
|
||||||
(cond
|
(cond
|
||||||
(some? redirect-href)
|
(some? redirect-href)
|
||||||
(binding [s/*sync* true]
|
(binding [s/*sync* true]
|
||||||
|
|
|
@ -42,7 +42,8 @@
|
||||||
(mf/lazy-component app.main.ui.workspace/workspace))
|
(mf/lazy-component app.main.ui.workspace/workspace))
|
||||||
|
|
||||||
(mf/defc main-page
|
(mf/defc main-page
|
||||||
{::mf/props :obj}
|
{::mf/props :obj
|
||||||
|
::mf/private true}
|
||||||
[{:keys [route profile]}]
|
[{:keys [route profile]}]
|
||||||
(let [{:keys [data params]} route
|
(let [{:keys [data params]} route
|
||||||
props (get profile :props)
|
props (get profile :props)
|
||||||
|
@ -68,6 +69,7 @@
|
||||||
(:onboarding-viewed props)
|
(:onboarding-viewed props)
|
||||||
(not= (:release-notes-viewed props) (:main cf/version))
|
(not= (:release-notes-viewed props) (:main cf/version))
|
||||||
(not= "0.0" (:main cf/version)))]
|
(not= "0.0" (:main cf/version)))]
|
||||||
|
|
||||||
[:& (mf/provider ctx/current-route) {:value route}
|
[:& (mf/provider ctx/current-route) {:value route}
|
||||||
(case (:name data)
|
(case (:name data)
|
||||||
(:auth-login
|
(:auth-login
|
||||||
|
|
|
@ -42,9 +42,7 @@
|
||||||
(let [search-term (get-in route [:params :query :search-term])
|
(let [search-term (get-in route [:params :query :search-term])
|
||||||
team-id (get-in route [:params :path :team-id])
|
team-id (get-in route [:params :path :team-id])
|
||||||
project-id (get-in route [:params :path :project-id])]
|
project-id (get-in route [:params :path :project-id])]
|
||||||
(cond->
|
(cond-> {:search-term search-term}
|
||||||
{:search-term search-term}
|
|
||||||
|
|
||||||
(uuid-str? team-id)
|
(uuid-str? team-id)
|
||||||
(assoc :team-id (uuid team-id))
|
(assoc :team-id (uuid team-id))
|
||||||
|
|
||||||
|
@ -84,10 +82,10 @@
|
||||||
|
|
||||||
(mf/use-effect on-resize)
|
(mf/use-effect on-resize)
|
||||||
|
|
||||||
|
|
||||||
[:div {:class (stl/css :dashboard-content)
|
[:div {:class (stl/css :dashboard-content)
|
||||||
:style {:pointer-events (when file-menu-open? "none")}
|
:style {:pointer-events (when file-menu-open? "none")}
|
||||||
:on-click clear-selected-fn :ref container}
|
:on-click clear-selected-fn
|
||||||
|
:ref container}
|
||||||
(case section
|
(case section
|
||||||
:dashboard-projects
|
:dashboard-projects
|
||||||
[:*
|
[:*
|
||||||
|
@ -146,7 +144,8 @@
|
||||||
(l/derived :current-team-id st/state))
|
(l/derived :current-team-id st/state))
|
||||||
|
|
||||||
(mf/defc dashboard
|
(mf/defc dashboard
|
||||||
[{:keys [route profile] :as props}]
|
{::mf/props :obj}
|
||||||
|
[{:keys [route profile]}]
|
||||||
(let [section (get-in route [:data :name])
|
(let [section (get-in route [:data :name])
|
||||||
params (parse-params route)
|
params (parse-params route)
|
||||||
|
|
||||||
|
|
|
@ -106,9 +106,9 @@
|
||||||
(st/emit! (rt/navigated match))
|
(st/emit! (rt/navigated match))
|
||||||
|
|
||||||
:else
|
:else
|
||||||
;; We just recheck with an additional profile request; this avoids
|
;; We just recheck with an additional profile request; this
|
||||||
;; some race conditions that causes unexpected redirects on
|
;; avoids some race conditions that causes unexpected redirects
|
||||||
;; invitations workflows (and probably other cases).
|
;; on invitations workflows (and probably other cases).
|
||||||
(->> (rp/cmd! :get-profile)
|
(->> (rp/cmd! :get-profile)
|
||||||
(rx/subs! (fn [{:keys [id] :as profile}]
|
(rx/subs! (fn [{:keys [id] :as profile}]
|
||||||
(cond
|
(cond
|
||||||
|
|
|
@ -7,19 +7,21 @@
|
||||||
(ns app.main.ui.static
|
(ns app.main.ui.static
|
||||||
(:require-macros [app.main.style :as stl])
|
(:require-macros [app.main.style :as stl])
|
||||||
(:require
|
(:require
|
||||||
|
["rxjs" :as rxjs]
|
||||||
[app.common.data :as d]
|
[app.common.data :as d]
|
||||||
[app.common.pprint :as pp]
|
[app.common.pprint :as pp]
|
||||||
[app.common.uri :as u]
|
[app.common.uri :as u]
|
||||||
[app.main.data.common :as dc]
|
[app.main.data.common :as dc]
|
||||||
[app.main.data.events :as ev]
|
[app.main.data.events :as ev]
|
||||||
|
[app.main.refs :as refs]
|
||||||
[app.main.repo :as rp]
|
[app.main.repo :as rp]
|
||||||
[app.main.store :as st]
|
[app.main.store :as st]
|
||||||
[app.main.ui.auth.login :refer [login-methods]]
|
[app.main.ui.auth.login :refer [login-methods]]
|
||||||
[app.main.ui.auth.recovery-request :refer [recovery-request-page recovery-sent-page]]
|
[app.main.ui.auth.recovery-request :refer [recovery-request-page recovery-sent-page]]
|
||||||
[app.main.ui.auth.register :refer [register-methods register-validate-form register-success-page terms-register]]
|
[app.main.ui.auth.register :as register]
|
||||||
[app.main.ui.dashboard.sidebar :refer [sidebar]]
|
[app.main.ui.dashboard.sidebar :refer [sidebar]]
|
||||||
[app.main.ui.icons :as i]
|
[app.main.ui.icons :as i]
|
||||||
[app.main.ui.viewer.header :as header]
|
[app.main.ui.viewer.header :as viewer.header]
|
||||||
[app.util.dom :as dom]
|
[app.util.dom :as dom]
|
||||||
[app.util.i18n :refer [tr]]
|
[app.util.i18n :refer [tr]]
|
||||||
[app.util.router :as rt]
|
[app.util.router :as rt]
|
||||||
|
@ -29,10 +31,14 @@
|
||||||
[potok.v2.core :as ptk]
|
[potok.v2.core :as ptk]
|
||||||
[rumext.v2 :as mf]))
|
[rumext.v2 :as mf]))
|
||||||
|
|
||||||
|
;; FIXME: this is a workaround until we export this class on beicon library
|
||||||
|
(def TimeoutError rxjs/TimeoutError)
|
||||||
|
|
||||||
(mf/defc error-container*
|
(mf/defc error-container*
|
||||||
{::mf/props :obj}
|
{::mf/props :obj}
|
||||||
[{:keys [children]}]
|
[{:keys [children]}]
|
||||||
(let [profile-id (:profile-id @st/state)]
|
(let [profile-id (:profile-id @st/state)
|
||||||
|
on-nav-root (mf/use-fn #(st/emit! (rt/nav-root)))]
|
||||||
[:section {:class (stl/css :exception-layout)}
|
[:section {:class (stl/css :exception-layout)}
|
||||||
[:button
|
[:button
|
||||||
{:class (stl/css :exception-header)
|
{:class (stl/css :exception-header)
|
||||||
|
@ -44,7 +50,7 @@
|
||||||
[:div {:class (stl/css :deco-before)} i/logo-error-screen]
|
[:div {:class (stl/css :deco-before)} i/logo-error-screen]
|
||||||
(when-not profile-id
|
(when-not profile-id
|
||||||
[:button {:class (stl/css :login-header)
|
[:button {:class (stl/css :login-header)
|
||||||
:on-click rt/nav-root}
|
:on-click on-nav-root}
|
||||||
(tr "labels.login")])
|
(tr "labels.login")])
|
||||||
|
|
||||||
[:div {:class (stl/css :exception-content)}
|
[:div {:class (stl/css :exception-content)}
|
||||||
|
@ -85,29 +91,37 @@
|
||||||
#(reset! current-section :login))
|
#(reset! current-section :login))
|
||||||
|
|
||||||
success-login
|
success-login
|
||||||
|
(mf/use-fn
|
||||||
(fn []
|
(fn []
|
||||||
(reset! show-dialog false)
|
(reset! show-dialog false)
|
||||||
(.reload js/window.location true))
|
(st/emit! (rt/reload true))))
|
||||||
|
|
||||||
success-register
|
success-register
|
||||||
|
(mf/use-fn
|
||||||
(fn [data]
|
(fn [data]
|
||||||
(reset! register-token (:token data))
|
(reset! register-token (:token data))
|
||||||
(reset! current-section :register-validate))
|
(reset! current-section :register-validate)))
|
||||||
|
|
||||||
register-email-sent
|
register-email-sent
|
||||||
|
(mf/use-fn
|
||||||
(fn [email]
|
(fn [email]
|
||||||
(reset! user-email email)
|
(reset! user-email email)
|
||||||
(reset! current-section :register-email-sent))
|
(reset! current-section :register-email-sent)))
|
||||||
|
|
||||||
recovery-email-sent
|
recovery-email-sent
|
||||||
|
(mf/use-fn
|
||||||
(fn [email]
|
(fn [email]
|
||||||
(reset! user-email email)
|
(reset! user-email email)
|
||||||
(reset! current-section :recovery-email-sent))]
|
(reset! current-section :recovery-email-sent)))
|
||||||
|
|
||||||
|
on-nav-root
|
||||||
|
(mf/use-fn #(st/emit! (rt/nav-root)))]
|
||||||
|
|
||||||
[:div {:class (stl/css :overlay)}
|
[:div {:class (stl/css :overlay)}
|
||||||
[:div {:class (stl/css :dialog-login)}
|
[:div {:class (stl/css :dialog-login)}
|
||||||
[:div {:class (stl/css :modal-close)}
|
[:div {:class (stl/css :modal-close)}
|
||||||
[:button {:class (stl/css :modal-close-button) :on-click rt/nav-root}
|
[:button {:class (stl/css :modal-close-button)
|
||||||
|
:on-click on-nav-root}
|
||||||
i/close]]
|
i/close]]
|
||||||
[:div {:class (stl/css :login)}
|
[:div {:class (stl/css :login)}
|
||||||
[:div {:class (stl/css :logo)} i/logo]
|
[:div {:class (stl/css :logo)} i/logo]
|
||||||
|
@ -125,13 +139,14 @@
|
||||||
(tr "auth.register")
|
(tr "auth.register")
|
||||||
" "
|
" "
|
||||||
[:a {:data-section "register"
|
[:a {:data-section "register"
|
||||||
:on-click set-section} (tr "auth.register-submit")]]]
|
:on-click set-section}
|
||||||
|
(tr "auth.register-submit")]]]
|
||||||
|
|
||||||
:register
|
:register
|
||||||
[:*
|
[:*
|
||||||
[:div {:class (stl/css :logo-title)} (tr "not-found.login.signup-free")]
|
[:div {:class (stl/css :logo-title)} (tr "not-found.login.signup-free")]
|
||||||
[:div {:class (stl/css :logo-subtitle)} (tr "not-found.login.start-using")]
|
[:div {:class (stl/css :logo-subtitle)} (tr "not-found.login.start-using")]
|
||||||
[:& register-methods {:on-success-callback success-register :hide-separator true}]
|
[:& register/register-methods {:on-success-callback success-register :hide-separator true}]
|
||||||
#_[:hr {:class (stl/css :separator)}]
|
#_[:hr {:class (stl/css :separator)}]
|
||||||
[:div {:class (stl/css :separator)}]
|
[:div {:class (stl/css :separator)}]
|
||||||
[:div {:class (stl/css :change-section)}
|
[:div {:class (stl/css :change-section)}
|
||||||
|
@ -141,11 +156,12 @@
|
||||||
:on-click set-section} (tr "auth.login-here")]]
|
:on-click set-section} (tr "auth.login-here")]]
|
||||||
[:div {:class (stl/css :links)}
|
[:div {:class (stl/css :links)}
|
||||||
[:hr {:class (stl/css :separator)}]
|
[:hr {:class (stl/css :separator)}]
|
||||||
[:& terms-register]]]
|
[:& register/terms-register]]]
|
||||||
|
|
||||||
:register-validate
|
:register-validate
|
||||||
[:div {:class (stl/css :form-container)}
|
[:div {:class (stl/css :form-container)}
|
||||||
[:& register-validate-form {:params {:token @register-token}
|
[:& register/register-validate-form
|
||||||
|
{:params {:token @register-token}
|
||||||
:on-success-callback register-email-sent}]
|
:on-success-callback register-email-sent}]
|
||||||
[:div {:class (stl/css :links)}
|
[:div {:class (stl/css :links)}
|
||||||
[:div {:class (stl/css :register)}
|
[:div {:class (stl/css :register)}
|
||||||
|
@ -155,7 +171,7 @@
|
||||||
|
|
||||||
:register-email-sent
|
:register-email-sent
|
||||||
[:div {:class (stl/css :form-container)}
|
[:div {:class (stl/css :form-container)}
|
||||||
[:& register-success-page {:params {:email @user-email :hide-logo true}}]]
|
[:& register/register-success-page {:params {:email @user-email :hide-logo true}}]]
|
||||||
|
|
||||||
:recovery-request
|
:recovery-request
|
||||||
[:& recovery-request-page {:go-back-callback set-section-login
|
[:& recovery-request-page {:go-back-callback set-section-login
|
||||||
|
@ -175,40 +191,49 @@
|
||||||
[:button {:class (stl/css :modal-close-button) :on-click on-close}
|
[:button {:class (stl/css :modal-close-button) :on-click on-close}
|
||||||
i/close]]
|
i/close]]
|
||||||
[:div {:class (stl/css :dialog-title)} title]
|
[:div {:class (stl/css :dialog-title)} title]
|
||||||
(for [txt content]
|
(for [[index content] (d/enumerate content)]
|
||||||
[:div txt])
|
[:div {:key index} content])
|
||||||
[:div {:class (stl/css :sign-info)}
|
[:div {:class (stl/css :sign-info)}
|
||||||
(when cancel-text
|
(when cancel-text
|
||||||
[:button {:class (stl/css :cancel-button) :on-click on-close} cancel-text])
|
[:button {:class (stl/css :cancel-button)
|
||||||
|
:on-click on-close}
|
||||||
|
cancel-text])
|
||||||
[:button {:on-click on-click} button-text]]]]))
|
[:button {:on-click on-click} button-text]]]]))
|
||||||
|
|
||||||
|
|
||||||
(mf/defc request-access
|
(mf/defc request-access
|
||||||
{::mf/props :obj}
|
{::mf/props :obj}
|
||||||
[{:keys [file-id team-id is-default workspace?]}]
|
[{:keys [file-id team-id is-default workspace?]}]
|
||||||
(let [profile (:profile @st/state)
|
(let [profile (mf/deref refs/profile)
|
||||||
requested* (mf/use-state {:sent false :already-requested false})
|
requested* (mf/use-state {:sent false :already-requested false})
|
||||||
requested (deref requested*)
|
requested (deref requested*)
|
||||||
show-dialog (mf/use-state true)
|
show-dialog (mf/use-state true)
|
||||||
|
|
||||||
on-close
|
on-close
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps profile)
|
(mf/deps profile)
|
||||||
(fn []
|
(fn []
|
||||||
(st/emit! (rt/nav :dashboard-projects {:team-id (:default-team-id profile)}))))
|
(st/emit! (rt/nav :dashboard-projects {:team-id (:default-team-id profile)}))))
|
||||||
|
|
||||||
on-success
|
on-success
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
#(reset! requested* {:sent true :already-requested false}))
|
#(reset! requested* {:sent true :already-requested false}))
|
||||||
|
|
||||||
on-error
|
on-error
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
#(reset! requested* {:sent true :already-requested true}))
|
#(reset! requested* {:sent true :already-requested true}))
|
||||||
|
|
||||||
on-request-access
|
on-request-access
|
||||||
(mf/use-fn
|
(mf/use-fn
|
||||||
(mf/deps file-id team-id workspace?)
|
(mf/deps file-id team-id workspace?)
|
||||||
(fn []
|
(fn []
|
||||||
(let [params (if (some? file-id) {:file-id file-id :is-viewer (not workspace?)} {:team-id team-id})
|
(let [params (if (some? file-id)
|
||||||
mdata {:on-success on-success :on-error on-error}]
|
{:file-id file-id
|
||||||
(st/emit! (dc/create-team-access-request (with-meta params mdata))))))]
|
:is-viewer (not workspace?)}
|
||||||
|
{:team-id team-id})
|
||||||
|
mdata {:on-success on-success
|
||||||
|
:on-error on-error}]
|
||||||
|
(st/emit! (dc/create-team-access-request
|
||||||
|
(with-meta params mdata))))))]
|
||||||
|
|
||||||
[:*
|
[:*
|
||||||
(if (some? file-id)
|
(if (some? file-id)
|
||||||
|
@ -220,8 +245,15 @@
|
||||||
[:div {:class (stl/css :project-name)} (tr "not-found.no-permission.project-name")]
|
[:div {:class (stl/css :project-name)} (tr "not-found.no-permission.project-name")]
|
||||||
[:div {:class (stl/css :file-name)} (tr "not-found.no-permission.penpot-file")]]]
|
[:div {:class (stl/css :file-name)} (tr "not-found.no-permission.penpot-file")]]]
|
||||||
[:div {:class (stl/css :workspace-right)}]]
|
[:div {:class (stl/css :workspace-right)}]]
|
||||||
|
|
||||||
[:div {:class (stl/css :viewer)}
|
[:div {:class (stl/css :viewer)}
|
||||||
[:& header/header {:project {:name (tr "not-found.no-permission.project-name")}
|
;; FIXME: the viewer header was never designed to be reused
|
||||||
|
;; from other parts of the application, and this code looks
|
||||||
|
;; like a fast workaround reusing it as-is without a proper
|
||||||
|
;; component adaptation for be able to use it easily it on
|
||||||
|
;; viewer context or static error page context
|
||||||
|
[:& viewer.header/header {:project
|
||||||
|
{:name (tr "not-found.no-permission.project-name")}
|
||||||
:index 0
|
:index 0
|
||||||
:file {:name (tr "not-found.no-permission.penpot-file")}
|
:file {:name (tr "not-found.no-permission.penpot-file")}
|
||||||
:page nil
|
:page nil
|
||||||
|
@ -392,59 +424,87 @@
|
||||||
[:div {:class (stl/css :sign-info)}
|
[:div {:class (stl/css :sign-info)}
|
||||||
[:button {:on-click on-reset} (tr "labels.retry")]]]))
|
[:button {:on-click on-reset} (tr "labels.retry")]]]))
|
||||||
|
|
||||||
|
(defn- load-info
|
||||||
|
"Load exception page info"
|
||||||
|
[path-params]
|
||||||
|
(let [default {:loaded true}
|
||||||
|
stream (cond
|
||||||
|
(:file-id path-params)
|
||||||
|
(->> (rp/cmd! :get-file-info {:id (:file-id path-params)})
|
||||||
|
(rx/map (fn [info]
|
||||||
|
{:loaded true
|
||||||
|
:file-id (:id info)})))
|
||||||
|
|
||||||
|
(:team-id path-params)
|
||||||
|
(->> (rp/cmd! :get-team-info {:id (:team-id path-params)})
|
||||||
|
(rx/map (fn [info]
|
||||||
|
{:loaded true
|
||||||
|
:team-id (:id info)
|
||||||
|
:team-default (:is-default info)})))
|
||||||
|
|
||||||
|
:else
|
||||||
|
(rx/of default))]
|
||||||
|
|
||||||
|
(->> stream
|
||||||
|
(rx/timeout 3000)
|
||||||
|
(rx/catch (fn [cause]
|
||||||
|
(if (instance? TimeoutError cause)
|
||||||
|
(rx/of default)
|
||||||
|
(rx/throw cause)))))))
|
||||||
|
|
||||||
|
|
||||||
(mf/defc exception-page*
|
(mf/defc exception-page*
|
||||||
{::mf/props :obj}
|
{::mf/props :obj}
|
||||||
[{:keys [data route] :as props}]
|
[{:keys [data route] :as props}]
|
||||||
|
|
||||||
(let [file-info (mf/use-state {:pending true})
|
(let [type (:type data)
|
||||||
team-info (mf/use-state {:pending true})
|
|
||||||
type (:type data)
|
|
||||||
path (:path route)
|
path (:path route)
|
||||||
|
|
||||||
|
query-params (:query-params route)
|
||||||
|
path-params (:path-params route)
|
||||||
|
|
||||||
workspace? (str/includes? path "workspace")
|
workspace? (str/includes? path "workspace")
|
||||||
dashboard? (str/includes? path "dashboard")
|
dashboard? (str/includes? path "dashboard")
|
||||||
view? (str/includes? path "view")
|
view? (str/includes? path "view")
|
||||||
|
|
||||||
request-access? (and
|
;; We stora the request access info int this state
|
||||||
|
info* (mf/use-state nil)
|
||||||
|
info (deref info*)
|
||||||
|
|
||||||
|
loaded? (get info :loaded false)
|
||||||
|
|
||||||
|
request-access?
|
||||||
|
(and
|
||||||
(or workspace? dashboard? view?)
|
(or workspace? dashboard? view?)
|
||||||
(or (not (str/empty? (:file-id @file-info))) (not (str/empty? (:team-id @team-info)))))
|
(or (:file-id info)
|
||||||
|
(:team-id info)))]
|
||||||
|
|
||||||
query-params (u/map->query-string (:query-params route))
|
(mf/with-effect [type path query-params path-params]
|
||||||
pparams (:path-params route)
|
(let [query-params (u/map->query-string query-params)
|
||||||
on-file-info (mf/use-fn
|
event-params {::ev/name "exception-page"
|
||||||
(fn [info]
|
:type type
|
||||||
(reset! file-info {:file-id (:id info)})))
|
:path path
|
||||||
on-team-info (mf/use-fn
|
:query-params query-params}]
|
||||||
(fn [info]
|
(st/emit! (ptk/event ::ev/event event-params))))
|
||||||
(reset! team-info {:team-id (:id info) :is-default (:is-default info)})))]
|
|
||||||
|
|
||||||
(mf/with-effect [type path query-params pparams @file-info @team-info]
|
(mf/with-effect [path-params info]
|
||||||
(st/emit! (ptk/event ::ev/event {::ev/name "exception-page" :type type :path path :query-params query-params}))
|
(when-not (:loaded info)
|
||||||
|
(->> (load-info path-params)
|
||||||
|
(rx/subs! (partial reset! info*)))))
|
||||||
|
|
||||||
(when (and (:file-id pparams) (:pending @file-info))
|
(when loaded?
|
||||||
(->> (rp/cmd! :get-file-info {:id (:file-id pparams)})
|
(if request-access?
|
||||||
(rx/subs! on-file-info)))
|
[:& request-access {:file-id (:file-id info)
|
||||||
|
:team-id (:team-id info)
|
||||||
(when (and (:team-id pparams) (:pending @team-info))
|
:is-default (:team-default info)
|
||||||
(->> (rp/cmd! :get-team-info {:id (:team-id pparams)})
|
:workspace? workspace?}]
|
||||||
(rx/subs! on-team-info))))
|
|
||||||
|
|
||||||
(case (:type data)
|
(case (:type data)
|
||||||
:not-found
|
:not-found
|
||||||
(if request-access?
|
[:> not-found* {}]
|
||||||
[:& request-access {:file-id (:file-id @file-info)
|
|
||||||
:team-id (:team-id @team-info)
|
|
||||||
:is-default (:is-default @team-info)
|
|
||||||
:workspace? workspace?}]
|
|
||||||
[:> not-found* {}])
|
|
||||||
|
|
||||||
:authentication
|
:authentication
|
||||||
(if request-access?
|
[:> not-found* {}]
|
||||||
[:& request-access {:file-id (:file-id @file-info)
|
|
||||||
:team-id (:team-id @team-info)
|
|
||||||
:is-default (:is-default @team-info)
|
|
||||||
:workspace? workspace?}]
|
|
||||||
[:> not-found* {}])
|
|
||||||
|
|
||||||
:bad-gateway
|
:bad-gateway
|
||||||
[:> bad-gateway* props]
|
[:> bad-gateway* props]
|
||||||
|
@ -452,4 +512,4 @@
|
||||||
:service-unavailable
|
:service-unavailable
|
||||||
[:& service-unavailable]
|
[:& service-unavailable]
|
||||||
|
|
||||||
[:> internal-error* props])))
|
[:> internal-error* props])))))
|
||||||
|
|
|
@ -760,8 +760,10 @@
|
||||||
(.back (.-history js/window)))
|
(.back (.-history js/window)))
|
||||||
|
|
||||||
(defn reload-current-window
|
(defn reload-current-window
|
||||||
[]
|
([]
|
||||||
(.reload (.-location js/window)))
|
(.reload globals/location))
|
||||||
|
([force?]
|
||||||
|
(.reload globals/location force?)))
|
||||||
|
|
||||||
(defn scroll-by!
|
(defn scroll-by!
|
||||||
([element x y]
|
([element x y]
|
||||||
|
|
|
@ -148,7 +148,17 @@
|
||||||
(defn nav-root
|
(defn nav-root
|
||||||
"Navigate to the root page."
|
"Navigate to the root page."
|
||||||
[]
|
[]
|
||||||
(set! (.-href globals/location) "/"))
|
(ptk/reify ::nav-root
|
||||||
|
ptk/EffectEvent
|
||||||
|
(effect [_ _ _]
|
||||||
|
(set! (.-href globals/location) "/"))))
|
||||||
|
|
||||||
|
(defn reload
|
||||||
|
[force?]
|
||||||
|
(ptk/reify ::reload
|
||||||
|
ptk/EffectEvent
|
||||||
|
(effect [_ _ _]
|
||||||
|
(ts/asap (partial dom/reload-current-window force?)))))
|
||||||
|
|
||||||
(defn nav-raw
|
(defn nav-raw
|
||||||
[& {:keys [href uri]}]
|
[& {:keys [href uri]}]
|
||||||
|
|
Loading…
Add table
Reference in a new issue