Rename default-value to default-db

This commit is contained in:
Christophe Gragnic 2017-08-07 09:07:39 +02:00
parent a46592f37a
commit 292c8d8ea8
2 changed files with 5 additions and 5 deletions

View File

@ -43,9 +43,9 @@
;; 2. `events.cljs` for the registration of :initialise-db handler ;; 2. `events.cljs` for the registration of :initialise-db handler
;; ;;
(def default-value ;; what gets put into app-db by default. (def default-db ;; what gets put into app-db by default.
{:todos (sorted-map) ;; an empty list of todos. Use the (int) :id as the key {:todos (sorted-map) ;; an empty list of todos. Use the (int) :id as the key
:showing :all}) ;; show all todos :showing :all}) ;; show all todos
;; -- Local Storage ---------------------------------------------------------- ;; -- Local Storage ----------------------------------------------------------

View File

@ -1,6 +1,6 @@
(ns todomvc.events (ns todomvc.events
(:require (:require
[todomvc.db :refer [default-value todos->local-store]] [todomvc.db :refer [default-db todos->local-store]]
[re-frame.core :refer [reg-event-db reg-event-fx inject-cofx path trim-v [re-frame.core :refer [reg-event-db reg-event-fx inject-cofx path trim-v
after debug]] after debug]]
[cljs.spec :as s])) [cljs.spec :as s]))
@ -98,7 +98,7 @@
;; the event handler (function) being registered ;; the event handler (function) being registered
(fn [{:keys [db local-store-todos]} _] ;; take 2 vals from coeffects. Ignore event vector itself. (fn [{:keys [db local-store-todos]} _] ;; take 2 vals from coeffects. Ignore event vector itself.
{:db (assoc default-value :todos local-store-todos)})) ;; all hail the new state {:db (assoc default-db :todos local-store-todos)})) ;; all hail the new state
;; usage: (dispatch [:set-showing :active]) ;; usage: (dispatch [:set-showing :active])