Makes the history page use local storage
This commit is contained in:
@@ -11,6 +11,17 @@
|
|||||||
[datomic.api :as d]
|
[datomic.api :as d]
|
||||||
[hiccup2.core :as hiccup]))
|
[hiccup2.core :as hiccup]))
|
||||||
|
|
||||||
|
(defn setup-script [request]
|
||||||
|
(str
|
||||||
|
"
|
||||||
|
window.onload = function () {
|
||||||
|
document.body.addEventListener(\"htmx:configRequest\", function(event) {
|
||||||
|
event.detail.headers[\"Authorization\"] = \"Token \" + localStorage.getItem(\"jwt\") ;
|
||||||
|
|
||||||
|
console.log(event.detail.headers[\"Authorization\"]);
|
||||||
|
});
|
||||||
|
}"))
|
||||||
|
|
||||||
(defn base-page [request contents]
|
(defn base-page [request contents]
|
||||||
[:html.has-navbar-fixed-top
|
[:html.has-navbar-fixed-top
|
||||||
[:head
|
[:head
|
||||||
@@ -29,19 +40,13 @@
|
|||||||
[:link {:rel "stylesheet", :href "/css/main.css"}]
|
[:link {:rel "stylesheet", :href "/css/main.css"}]
|
||||||
[:link {:rel "stylesheet", :href "https://unpkg.com/placeholder-loading/dist/css/placeholder-loading.min.css"}]
|
[:link {:rel "stylesheet", :href "https://unpkg.com/placeholder-loading/dist/css/placeholder-loading.min.css"}]
|
||||||
[:script {:src "https://unpkg.com/hyperscript.org@0.9.7"}]
|
[:script {:src "https://unpkg.com/hyperscript.org@0.9.7"}]
|
||||||
[:script {:src "https://unpkg.com/htmx.org@1.8.4"
|
[:script {:src "https://unpkg.com/htmx.org@1.8.4"
|
||||||
:integrity "sha384-wg5Y/JwF7VxGk4zLsJEcAojRtlVp1FKKdGy1qN+OMtdq72WRvX/EdRdqg/LOhYeV"
|
:integrity "sha384-wg5Y/JwF7VxGk4zLsJEcAojRtlVp1FKKdGy1qN+OMtdq72WRvX/EdRdqg/LOhYeV"
|
||||||
:crossorigin="anonymous"}]
|
:crossorigin= "anonymous"}]
|
||||||
[:script {:type "text/javascript", :src "https://cdn.yodlee.com/fastlink/v4/initialize.js", :async "async" }]]
|
[:script {:type "text/javascript", :src "https://cdn.yodlee.com/fastlink/v4/initialize.js", :async "async" }]
|
||||||
[:script {:type "text/javascript"}
|
[:script {:type "text/javascript"}
|
||||||
(hiccup/raw
|
(hiccup/raw (setup-script request))]]
|
||||||
(str
|
|
||||||
"
|
|
||||||
window.onload = function () {
|
|
||||||
document.body.addEventListener(\"htmx:configRequest\", function(event) {
|
|
||||||
event.detail.headers[\"Authorization\"] = \"Token " (get (:query-params request) "jwt")" \" ;
|
|
||||||
});
|
|
||||||
}"))]
|
|
||||||
|
|
||||||
[:body
|
[:body
|
||||||
[:div {:id "app"}
|
[:div {:id "app"}
|
||||||
@@ -81,6 +86,7 @@ window.onload = function () {
|
|||||||
{:status 200
|
{:status 200
|
||||||
:headers {"Content-Type" "text/html"}
|
:headers {"Content-Type" "text/html"}
|
||||||
:body (str
|
:body (str
|
||||||
|
"<!DOCTYPE html>"
|
||||||
(hiccup/html
|
(hiccup/html
|
||||||
{}
|
{}
|
||||||
hiccup))})
|
hiccup))})
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
[:li.menu-item
|
[:li.menu-item
|
||||||
[:a {:href (str "/admin/history?jwt=" (.getItem js/localStorage "jwt")) :class (str "item" (active-when ap = :admin-history))}
|
[:a {:href (str "/admin/history?jwt=" (.getItem js/localStorage "jwt")) :class (str "item" (active-when ap = :admin-history))}
|
||||||
[:span {:class "icon icon-cog-play-1" :style {:font-size "25px"}}]
|
[:span {:class "icon icon-cog-play-1" :style {:font-size "25px"}}]
|
||||||
[:span {:class "name"} "History"]]]
|
[:span {:class "name"} "History "]]]
|
||||||
[:ul ]]
|
[:ul ]]
|
||||||
[:p.menu-label "Import"]
|
[:p.menu-label "Import"]
|
||||||
[:ul.menu-list
|
[:ul.menu-list
|
||||||
|
|||||||
Reference in New Issue
Block a user