- Update the way to use the data records on Vuex with Getters!
- Fix: mongodb call passing array todos and categiroes already splitted
This commit is contained in:
@@ -105,6 +105,7 @@ router.patch('/:id', authenticate, (req, res) => {
|
||||
|
||||
router.get('/:userId', authenticate, (req, res) => {
|
||||
var userId = req.params.userId;
|
||||
// var category = req.params.category;
|
||||
|
||||
tools.mylog('GET : ', req.params);
|
||||
|
||||
@@ -118,11 +119,13 @@ router.get('/:userId', authenticate, (req, res) => {
|
||||
}
|
||||
|
||||
// Extract all the todos of the userId only
|
||||
Todo.findAllByUserId(userId).then((todos) => {
|
||||
// Todo.findAllByUserIdAndCat(userId, category).then((todos) => {
|
||||
Todo.getAllTodo(userId).then((objtodos) => {
|
||||
|
||||
tools.mylog('todos', todos.length);
|
||||
tools.mylog('todos', objtodos.arrtodos.length);
|
||||
tools.mylog('categories', objtodos.arrcategories.length);
|
||||
|
||||
res.send({ todos: todos });
|
||||
res.send({ todos: objtodos.arrtodos, categories: objtodos.arrcategories });
|
||||
}).catch((e) => {
|
||||
console.log(e);
|
||||
res.status(400).send(e);
|
||||
|
||||
Reference in New Issue
Block a user