auth now actually works straight through google
This commit is contained in:
@@ -27,6 +27,9 @@
|
||||
|
||||
(defn ^:export init []
|
||||
(dev-setup)
|
||||
(when-let [jwt (.get (js/URLSearchParams. (.-search (.-location js/window))) "jwt")]
|
||||
(println "got jwt" jwt)
|
||||
(.setItem js/localStorage "jwt" jwt))
|
||||
(pushy/start! (pushy/pushy dispatch-route parse-url))
|
||||
(re-frame/dispatch-sync [::events/initialize-db])
|
||||
(mount-root))
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
(ns auto-ap.db)
|
||||
|
||||
(def default-db
|
||||
{:user nil
|
||||
{:user (.getItem js/localStorage "jwt")
|
||||
:company {:name "Campbell Brewing Company"}
|
||||
:companies [{:name "Campbell Brewing Company"
|
||||
:matches ["campbell brewing company" "campbell brewery company" "campbell brewing"]}
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
(ns auto-ap.subs
|
||||
(:require [re-frame.core :as re-frame]))
|
||||
(:require [re-frame.core :as re-frame]
|
||||
[clojure.string :as str]
|
||||
[goog.crypt.base64 :as base64]))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::company
|
||||
@@ -19,7 +21,10 @@
|
||||
(re-frame/reg-sub
|
||||
::user
|
||||
(fn [db]
|
||||
(:user db)))
|
||||
(when (:user db)
|
||||
(let [{:strs [name] :as x} (js->clj (.parse js/JSON (base64/decodeString (second (str/split (:user db) #"\.")))))]
|
||||
(println x)
|
||||
{:name name}))))
|
||||
|
||||
(re-frame/reg-sub
|
||||
::active-page
|
||||
|
||||
@@ -224,7 +224,8 @@
|
||||
)
|
||||
(defn login []
|
||||
(let [user (re-frame/subscribe [::subs/user])]
|
||||
[:a {:class "navbar-link login" :href (login-url)} (or (get @user "name") "Login")]))
|
||||
(println @user)
|
||||
[:a {:class "navbar-link login" :href (login-url)} (or (:name @user) "Login")]))
|
||||
|
||||
(defn main-panel []
|
||||
(let [company (re-frame/subscribe [::subs/company])
|
||||
|
||||
Reference in New Issue
Block a user