sombriks

Untitled

Nov 6th, 2015
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // www/js/todolist.js
  2.   $scope.encerrartarefa=function(tarefa){
  3.     $http({
  4.       method : "POST",
  5.       url : "encerrartarefa?idtarefa="+tarefa.idtarefa,
  6.     }).then(function(res){
  7.       alert(res.data);
  8.       $scope.inittodolist();
  9.     });
  10.   };
  11.  
  12.  
  13. // index.js
  14. app.post("/encerrartarefa",function(req,res){
  15. //  var deletartarefa = req.body;
  16.   knex("tarefas").where({
  17.     idtarefa:req.query.idtarefa
  18.   }).del().then(function(retid){
  19.     res.send("Tarefa: "+req.query.idtarefa+" removida");
  20.   }).catch(function(err){
  21.     console.log(err);
  22.     res.status(500).send("Erro ao remover tarefa");
  23.   });
  24.   console.log("testestesfadsad");
  25. });
Advertisement
Add Comment
Please, Sign In to add comment