mirror of
https://github.com/status-im/re-frame.git
synced 2025-02-22 14:58:12 +00:00
Start to simplify todomvc
This commit is contained in:
parent
13840ed9a1
commit
9bb1b4e459
@ -10,12 +10,13 @@
|
|||||||
;; -- Middleware --------------------------------------------------------------
|
;; -- Middleware --------------------------------------------------------------
|
||||||
;;
|
;;
|
||||||
;; checks that the structure in app-db matches the schema
|
;; checks that the structure in app-db matches the schema
|
||||||
(def check-schema (after valid-schema?))
|
(def schema-ok? (after valid-schema?))
|
||||||
|
|
||||||
|
;; store todos in local storage
|
||||||
(def write-ls-todos (after #(set-local-storage! :todos %)))
|
(def write-ls-todos (after #(set-local-storage! :todos %)))
|
||||||
|
|
||||||
;; middleware for any handler which manipulates todos.
|
;; middleware for a handler which manipulates todos.
|
||||||
(def todo-middleware [check-schema (path [:todos]) write-ls-todos debug trim-v])
|
(def todo-middleware [schema-ok? (path :todos) write-ls-todos debug trim-v])
|
||||||
|
|
||||||
|
|
||||||
;; -- Helpers -----------------------------------------------------------------
|
;; -- Helpers -----------------------------------------------------------------
|
||||||
@ -39,7 +40,7 @@
|
|||||||
|
|
||||||
(register-handler ;; handlers changes the footer filter
|
(register-handler ;; handlers changes the footer filter
|
||||||
:set-showing ;; event-id
|
:set-showing ;; event-id
|
||||||
[(path [:showing]) #_write-ls check-schema debug trim-v] ;; middleware (wraps the handler)
|
[(path :showing) check-schema debug trim-v] ;; middleware (wraps the handler)
|
||||||
(fn ;; handler
|
(fn ;; handler
|
||||||
[db [filter-kw]]
|
[db [filter-kw]]
|
||||||
filter-kw))
|
filter-kw))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user