Use interceptor factory(after) in reagent6/events.cljs
This commit is contained in:
parent
1fe4fcd77a
commit
ef8780f806
|
@ -1,6 +1,6 @@
|
||||||
(ns $PROJECT_NAME_HYPHENATED$.events
|
(ns $PROJECT_NAME_HYPHENATED$.events
|
||||||
(:require
|
(:require
|
||||||
[re-frame.core :refer [reg-event-db ->interceptor]]
|
[re-frame.core :refer [reg-event-db after]]
|
||||||
[clojure.spec :as s]
|
[clojure.spec :as s]
|
||||||
[$PROJECT_NAME_HYPHENATED$.db :as db :refer [app-db]]))
|
[$PROJECT_NAME_HYPHENATED$.db :as db :refer [app-db]]))
|
||||||
|
|
||||||
|
@ -16,12 +16,9 @@
|
||||||
(throw (ex-info (str "Spec check failed: " explain-data) explain-data)))))
|
(throw (ex-info (str "Spec check failed: " explain-data) explain-data)))))
|
||||||
|
|
||||||
(def validate-spec
|
(def validate-spec
|
||||||
(->interceptor
|
|
||||||
:id :validate-spec
|
|
||||||
:after (fn [context]
|
|
||||||
(if goog.DEBUG
|
(if goog.DEBUG
|
||||||
(check-and-throw ::db/app-db (get-in context [:effects :db])))
|
(after (partial check-and-throw ::db/app-db))
|
||||||
context)))
|
[]))
|
||||||
|
|
||||||
;; -- Handlers --------------------------------------------------------------
|
;; -- Handlers --------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue