mirror of
https://github.com/metosin/reitit.git
synced 2025-12-18 08:51:12 +00:00
Add comment
This commit is contained in:
parent
51d24007e7
commit
6df97df424
1 changed files with 4 additions and 0 deletions
|
|
@ -140,6 +140,10 @@
|
||||||
(fn [new-match]
|
(fn [new-match]
|
||||||
(swap! state (fn [state]
|
(swap! state (fn [state]
|
||||||
(if new-match
|
(if new-match
|
||||||
|
;; Only run the controllers, which are likely to call authentcated APIs,
|
||||||
|
;; if user has been authenticated.
|
||||||
|
;; Alternative solution could be to always run controllers,
|
||||||
|
;; check authentication status in each controller, or check authentication status in API calls.
|
||||||
(if (:user state)
|
(if (:user state)
|
||||||
(assoc state :match (assoc new-match :controllers (rfc/apply-controllers (:controllers (:match state)) new-match)))
|
(assoc state :match (assoc new-match :controllers (rfc/apply-controllers (:controllers (:match state)) new-match)))
|
||||||
(assoc state :match new-match))))))
|
(assoc state :match new-match))))))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue