40 lines
1.1 KiB
Clojure
40 lines
1.1 KiB
Clojure
(ns auto-ap.core
|
|
(:require [reagent.core :as reagent]
|
|
[reagent.dom :as rdom]
|
|
[re-frame.core :as re-frame]
|
|
[auto-ap.events :as events]
|
|
[auto-ap.views.main :refer [page active-page] ]
|
|
[auto-ap.reload :as reload]
|
|
[auto-ap.events :as events]
|
|
|
|
[auto-ap.config :as config]
|
|
[auto-ap.effects :as effects]
|
|
[pushy.core :as pushy]
|
|
[auto-ap.history :as p]
|
|
[bidi.bidi :as bidi]))
|
|
|
|
#_(set! *warn-on-infer* true)
|
|
|
|
(defn dev-setup []
|
|
(when true
|
|
(enable-console-print!)
|
|
(println "dev mode enabled")))
|
|
|
|
(defn mount-root []
|
|
(re-frame/clear-subscription-cache!)
|
|
(rdom/render [active-page]
|
|
(.getElementById js/document "app")))
|
|
|
|
(defn ^:export init []
|
|
(dev-setup)
|
|
|
|
(if-let [jwt (.get (js/URLSearchParams. (.-search (.-location js/window))) "jwt")]
|
|
(do
|
|
(.setItem js/localStorage "jwt" jwt)
|
|
(re-frame/dispatch-sync [::events/initialize-db jwt]))
|
|
(do
|
|
(re-frame/dispatch-sync [::events/initialize-db (.getItem js/localStorage "jwt")])))
|
|
(pushy/start! p/history)
|
|
(mount-root))
|
|
|