Skip to content

Commit

Permalink
Switch to Fulcro RAD app
Browse files Browse the repository at this point in the history
  • Loading branch information
duck1123 committed Sep 18, 2021
1 parent 4def997 commit b9289c5
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
20 changes: 2 additions & 18 deletions src/main/dinsro/app.cljs
@@ -1,22 +1,6 @@
(ns dinsro.app
(:require
[com.fulcrologic.fulcro.application :as app]
[com.fulcrologic.fulcro.networking.http-remote :as http]
[com.fulcrologic.rad.application :as rad-app]
[taoensso.timbre :as log]))

(defonce app
(app/fulcro-app
{:remotes
{:remote
(http/fulcro-http-remote
{:url "/api"
:request-middleware
(comp (http/wrap-fulcro-request)
(http/wrap-csrf-token js/window.fulcro_network_csrf_token))})}

:remote-error?
(fn [result]
(let [{:keys [status-code]} result]
(when-not (= status-code 200)
(log/errorf "Error: %s" result)
(js/console.log result))))}))
(defonce app (rad-app/fulcro-rad-app {}))
20 changes: 18 additions & 2 deletions src/main/dinsro/client.cljs
@@ -1,9 +1,16 @@
(ns dinsro.client
(:require
[com.fulcrologic.fulcro.algorithms.timbre-support :refer [console-appender prefix-output-fn]]
[com.fulcrologic.fulcro.application :as app]
[com.fulcrologic.fulcro.components :as comp]
[com.fulcrologic.fulcro.routing.dynamic-routing :as dr]
[com.fulcrologic.rad.application :as rad-app]
[com.fulcrologic.rad.rendering.semantic-ui.semantic-ui-controls :as sui]
[com.fulcrologic.rad.report :as report]
[com.fulcrologic.rad.routing.history :as history]
[com.fulcrologic.rad.routing.html5-history :as hist5 :refer [html5-history]]
[dinsro.app :as da]
[dinsro.routing :as routing]
[dinsro.routing :as d.routing]
[dinsro.translations :refer [tr]]
[dinsro.ui :as ui]
[taoensso.timbre :as log]
Expand All @@ -12,13 +19,22 @@
(defonce stats-accumulator
(tufte/add-accumulating-handler! {:ns-pattern "*"}))

(defn setup-RAD [app]
(rad-app/install-ui-controls! app sui/all-controls)
(report/install-formatter! app :boolean :affirmation (fn [_ value] (if value "yes" "no"))))

(defn ^:export start
"Shadow-cljs sets this up to be our entry-point function.
See shadow-cljs.edn `:init-fn` in the modules of the main build."
[]
(log/merge-config! {:output-fn prefix-output-fn
:appenders {:console (console-appender)}})
(app/set-root! da/app ui/Root {:initialize-state? true})
(d.routing/start!)
(setup-RAD da/app)
(dr/change-route! da/app [""])
(history/install-route-history! da/app (html5-history))
(app/mount! da/app ui/Root "app" {:initialize-state? false})
(routing/start!)
(js/console.log "Loaded"))

(defn ^:export refresh
Expand Down

0 comments on commit b9289c5

Please sign in to comment.