equal
deleted
inserted
replaced
1 import Immutable from 'immutable'; |
1 import Immutable from 'immutable'; |
2 // import PouchDB from 'pouchdb'; |
|
3 |
|
4 import * as types from '../constants/actionTypes'; |
2 import * as types from '../constants/actionTypes'; |
5 import noteRecord from '../store/noteRecord'; |
3 import noteRecord from '../store/noteRecord'; |
6 |
|
7 // const db = new PouchDB('notes'); |
|
8 |
|
9 // db.allDocs({ include_docs: true, descending: true }, function(err, doc) { |
|
10 // console.log(doc.rows) |
|
11 // }); |
|
12 |
4 |
13 export default (state = Immutable.List([]), action) => { |
5 export default (state = Immutable.List([]), action) => { |
14 switch (action.type) { |
6 switch (action.type) { |
15 case types.ADD_NOTE: |
7 case types.ADD_NOTE: |
16 return state.push(new noteRecord(action.note)); |
8 return state.push(new noteRecord(action.note)); |
|
9 case types.LOAD_NOTES_BY_SESSION: |
|
10 return action.notes; |
17 default: |
11 default: |
18 return state; |
12 return state; |
19 } |
13 } |
20 }; |
14 }; |