Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. driverList = Driver.query(); // Obtengo el resultado
  2.  
  3. export function DriverResource($resource) {
  4. 'ngInject';
  5.  
  6. return $resource('/api/drivers/:id');
  7. }
  8.  
  9. router.get('/', controller.index);
  10.  
  11. export function index(req, res) {
  12. return Driver.find().exec()
  13. .then(respondWithResult(res))
  14. .catch(handleError(res));
  15. }
  16.  
  17. Driver.query({company: Auth.getCurrentUser()._id}, function(res){
  18. console.log(res); // Error 404
  19. })
  20.  
  21. export function DriverResource($resource) {
  22. 'ngInject';
  23.  
  24. return $resource('/api/drivers/:id/:company', {company: '@_id'});
  25. }
  26.  
  27. router.get('/:company', controller.index);
  28.  
  29. export function index(req, res) {
  30. return Driver.find({company: req.params.company}).exec()
  31. .then(function(res){
  32. console.log(res); // Aquí obtengo bien el resultado, pero no se envía al cliente...
  33. respondWithResult(res))
  34. }
  35. .catch(handleError(res));
  36. }
  37.  
  38. Possibly unhandled rejection: {"data":{"status":404},"status":404,"config":{"method":"GET","transformRequest":[null],"transformResponse":[null],"jsonpCallbackParam":"callback","url":"/api/drivers","headers":{"Accept":"application/json, text/plain, */*","Authorization":"Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJfaWQiOiI1OTZiMzMyODMwNTVjZDBmMjQ0MmNkODUiLCJyb2xlIjoiY29tcGFueSIsImlhdCI6MTUwMDcxMDg4NiwiZXhwIjoxNTAwNzI4ODg2fQ._90ABv_HGBYt8w8XxvUBdofBw47-esDqDZa8OBT1u1E"}},"statusText":"Not Found"}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement