| author | Alexandre Segura <mex.zktk@gmail.com> |
| Wed, 31 May 2017 17:51:54 +0200 | |
| changeset 12 | 48ddaa42b810 |
| parent 3 | 3b5d37d84cfe |
| child 29 | 4cfeabef7d5e |
| permissions | -rw-r--r-- |
|
3
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
1 |
import Immutable from 'immutable'; |
|
12
48ddaa42b810
Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents:
3
diff
changeset
|
2 |
// import PouchDB from 'pouchdb'; |
|
3
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
3 |
|
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
4 |
import * as types from '../constants/actionTypes'; |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
5 |
import noteRecord from '../store/noteRecord'; |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
6 |
|
|
12
48ddaa42b810
Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents:
3
diff
changeset
|
7 |
// const db = new PouchDB('notes'); |
|
48ddaa42b810
Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents:
3
diff
changeset
|
8 |
|
|
48ddaa42b810
Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents:
3
diff
changeset
|
9 |
// db.allDocs({ include_docs: true, descending: true }, function(err, doc) { |
|
48ddaa42b810
Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents:
3
diff
changeset
|
10 |
// console.log(doc.rows) |
|
48ddaa42b810
Draft implementation of sessions.
Alexandre Segura <mex.zktk@gmail.com>
parents:
3
diff
changeset
|
11 |
// }); |
|
3
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
12 |
|
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
13 |
export default (state = Immutable.List([]), action) => { |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
14 |
switch (action.type) { |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
15 |
case types.ADD_NOTE: |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
16 |
return state.push(new noteRecord(action.note)); |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
17 |
default: |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
18 |
return state; |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
19 |
} |
|
3b5d37d84cfe
Some code rename and reorg + basic tests
ymh <ymh.work@gmail.com>
parents:
diff
changeset
|
20 |
}; |