Fix linter issues on frontend (part 6).

This commit is contained in:
Andrey Antukh 2021-06-18 10:23:03 +02:00 committed by Andrés Moya
parent 0f3e4c289c
commit e796c3dfba
55 changed files with 629 additions and 771 deletions

View file

@ -6,15 +6,12 @@
(ns app.main.ui
(:require
[app.config :as cf]
[app.common.data :as d]
[app.common.exceptions :as ex]
[app.common.spec :as us]
[app.common.uuid :as uuid]
[app.config :as cfg]
[app.main.data.users :as du]
[app.main.data.messages :as dm]
[app.config :as cf]
[app.main.data.events :as ev]
[app.main.data.messages :as dm]
[app.main.data.users :as du]
[app.main.refs :as refs]
[app.main.store :as st]
[app.main.ui.auth :refer [auth]]
@ -32,8 +29,6 @@
[app.main.ui.static :as static]
[app.main.ui.viewer :refer [viewer-page]]
[app.main.ui.workspace :as workspace]
[app.util.i18n :as i18n :refer [tr t]]
[app.util.router :as rt]
[app.util.timers :as ts]
[cljs.pprint :refer [pprint]]
[cljs.spec.alpha :as s]
@ -60,11 +55,11 @@
(def routes
[["/auth"
["/login" :auth-login]
(when cfg/registration-enabled
(when cf/registration-enabled
["/register" :auth-register])
(when cfg/registration-enabled
(when cf/registration-enabled
["/register/validate" :auth-register-validate])
(when cfg/registration-enabled
(when cf/registration-enabled
["/register/success" :auth-register-success])
["/recovery/request" :auth-recovery-request]
["/recovery" :auth-recovery]
@ -102,9 +97,8 @@
(mf/defc on-main-error
[{:keys [error] :as props}]
(let [data (ex-data error)]
(mf/use-effect #(ptk/handle-error error))
[:span "Internal application errror"]))
(mf/use-effect #(ptk/handle-error error))
[:span "Internal application errror"])
(mf/defc main-page
{::mf/wrap [#(mf/catch % {:fallback on-main-error})]}
@ -211,14 +205,14 @@
(derive :service-unavailable ::exceptional-state)
(defmethod ptk/handle-error ::exceptional-state
[{:keys [status] :as error}]
[error]
(ts/schedule
(st/emitf (dm/assign-exception error))))
;; We receive a explicit authentication error; this explicitly clears
;; all profile data and redirect the user to the login page.
(defmethod ptk/handle-error :authentication
[error]
[_]
(ts/schedule (st/emitf (du/logout))))
;; Error that happens on an active bussines model validation does not
@ -245,7 +239,7 @@
;; Error on parsing an SVG
(defmethod ptk/handle-error :svg-parser
[error]
[_]
(ts/schedule
(st/emitf
(dm/show {:content "SVG is invalid or malformed"
@ -261,7 +255,7 @@
context (str/fmt "ns: '%s'\nname: '%s'\nfile: '%s:%s'"
(:ns context)
(:name context)
(str cfg/public-uri "js/cljs-runtime/" (:file context))
(str cf/public-uri "js/cljs-runtime/" (:file context))
(:line context))]
(ts/schedule
(st/emitf