mirror of
				https://github.com/KevinMidboe/moviedb.git
				synced 2025-10-29 17:50:25 +00:00 
			
		
		
		
	Updating superagent and using new syntax
This commit is contained in:
		| @@ -36,12 +36,13 @@ MovieDB.prototype.requestToken = function(fn){ | ||||
|   .get(endpoints.base_url  + endpoints.authentication.requestToken) | ||||
|   .query({'api_key': self.api_key}) | ||||
|   .set('Accept', 'application/json') | ||||
|   .end(function(res){ | ||||
|     if(!res.ok) return fn(res.error); | ||||
|     self.token = res.body; | ||||
|     fn(); | ||||
|   }).on('error', function(error){ | ||||
|     fn(error); | ||||
|   .end(function(err, res){ | ||||
|     if(err) { | ||||
|       fn(err); | ||||
|     } else { | ||||
|        self.token = res.body; | ||||
|        fn(); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   return this; | ||||
| @@ -90,10 +91,11 @@ var execMethod = function(type, params, endpoint, fn){ | ||||
|   else | ||||
|     req.send(params); | ||||
|  | ||||
|   req.end(function(res){ | ||||
|     if(res.ok) fn(null, res.body); | ||||
|     else fn(res.error, null); | ||||
|   req.end(function(err, res){ | ||||
|     if(err){ | ||||
|       fn(err); | ||||
|     } else { | ||||
|       fn(null, res.body); | ||||
|     } | ||||
|   }); | ||||
|  | ||||
|   req.on('error', fn); | ||||
| }; | ||||
|   | ||||
| @@ -27,6 +27,6 @@ | ||||
|   "main": "index.js", | ||||
|   "author": "Dan Zajdband <dan.zajdband@gmail.com>", | ||||
|   "dependencies": { | ||||
|     "superagent": "0.21.0" | ||||
|     "superagent": "^1.6.1" | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user