integrates new page into company section

This commit is contained in:
2023-01-14 13:52:09 -08:00
parent 6077c3119e
commit d2189ba460
10 changed files with 164 additions and 80 deletions

View File

@@ -2,15 +2,15 @@
(:require
[auto-ap.graphql.utils :refer [is-admin?]]
[buddy.auth :refer [authenticated?]]
[auto-ap.logging :as alog]))
[auto-ap.logging :as alog]
[cemerick.url :as url]))
(defn wrap-secure [handler]
(fn [request]
(if (authenticated? request)
(handler request)
{:status 401
:headers {"content-type" "text/html"}
:body "not authenticated"})))
{:status 302
:headers {"Location" "/login" }})))
(defn wrap-admin [handler]
(fn [request]
@@ -19,12 +19,11 @@
(do
(alog/warn ::unauthenticated)
{:status 302
:headers "/login"}))))
:headers {"Location" "/login"}}))))
(defn wrap-client-redirect-unauthenticated [handler]
(fn [request]
(let [response (handler request)]
(println )
(if (= 401 (get response :status))
(assoc-in response [:headers "hx-redirect"] "/login/")
response))))