Forces users to re login when there's a major update

This commit is contained in:
Bryce
2024-04-10 00:36:41 -07:00
parent ff2bf4c2b3
commit f12f8e14c2
6 changed files with 64 additions and 14 deletions

View File

@@ -197,27 +197,27 @@
"&variables=" (pr-str (or variables {})))}))]
(cond
(= (:status response) 401)
(re-frame/dispatch [:auto-ap.events/logout "Your session has expired. Please log in again."])
(>= (:status response) 400)
(let [error (->> response
:body
:errors
(dates->date-times)
(map #(assoc % :status (:status response)))
)]
(map #(assoc % :status (:status response))))]
(when (:multi owns-state)
(re-frame/dispatch [::status/error-multi (:multi owns-state) (:which owns-state) error]))
(when (:single owns-state)
(re-frame/dispatch [::status/error (:single owns-state) error]))
(when on-error
(->> error
(->> error
(conj on-error)
(re-frame/dispatch))))
:else
(do
(do
(when (:multi owns-state)
(re-frame/dispatch [::status/completed-multi (:multi owns-state) (:which owns-state)]))
(when (:single owns-state)

View File

@@ -60,7 +60,13 @@
(fn [{:keys [_]} [_ token]]
(let [handler (:handler (bidi/match-route routes/routes (.. js/window -location -pathname)))
last-client-id (.getItem js/localStorage "last-client-id")
last-selected-clients (js->clj (.parse js/JSON (.getItem js/localStorage "last-selected-clients")))
last-selected-clients (try (some->> "last-selected-clients"
(.getItem js/localStorage)
not-empty
(.parse js/JSON)
js->clj)
(catch js/Error e
:all))
last-selected-clients (mc/decode client-selection-schema last-selected-clients client-selection-transformer)
jwt-data (some-> token jwt->data)
selected-client-assignment (cond (and token
@@ -74,7 +80,7 @@
[(js/parseInt last-client-id)]
:else
nil) ]
nil)]
(cond