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
|
||||
(:require
|
||||
[re-frame.core :refer [reg-event-db ->interceptor]]
|
||||
[re-frame.core :refer [reg-event-db after]]
|
||||
[clojure.spec :as s]
|
||||
[$PROJECT_NAME_HYPHENATED$.db :as db :refer [app-db]]))
|
||||
|
||||
|
@ -16,12 +16,9 @@
|
|||
(throw (ex-info (str "Spec check failed: " explain-data) explain-data)))))
|
||||
|
||||
(def validate-spec
|
||||
(->interceptor
|
||||
:id :validate-spec
|
||||
:after (fn [context]
|
||||
(if goog.DEBUG
|
||||
(check-and-throw ::db/app-db (get-in context [:effects :db])))
|
||||
context)))
|
||||
(after (partial check-and-throw ::db/app-db))
|
||||
[]))
|
||||
|
||||
;; -- Handlers --------------------------------------------------------------
|
||||
|
||||
|
|
Loading…
Reference in New Issue