Use interceptor factory(after) in reagent6/events.cljs

This commit is contained in:
Evan Rubinton 2016-10-03 12:43:09 -04:00
parent 1fe4fcd77a
commit ef8780f806
1 changed files with 4 additions and 7 deletions

View File

@ -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)))
(if goog.DEBUG
(after (partial check-and-throw ::db/app-db))
[]))
;; -- Handlers --------------------------------------------------------------