bu fixes
This commit is contained in:
@@ -6,31 +6,35 @@ module.exports.getDetails = function (detailsId, movieOrTv, tmdbApiKey, language
|
||||
if (movieOrTv == 'movie' || movieOrTv == 'tv') {
|
||||
|
||||
const detailURL = config.theMovieDbURL + movieOrTv + '/' + detailsId + '?api_key=' + tmdbApiKey + '&language=' + language;
|
||||
|
||||
|
||||
request(detailURL, (err, resultBody, body) => {
|
||||
if (resultBody != '') {
|
||||
const getJson = JSON.parse(resultBody.body);
|
||||
|
||||
const getJson = JSON.parse(resultBody.body);
|
||||
|
||||
if (getJson.status_code > 1) {
|
||||
// if wrong api key error
|
||||
const error = 'tmdb get detail wrong api key error';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
else {
|
||||
if (err) {
|
||||
// if thmdb api connection error
|
||||
const error = 'tmdb get detail api connection error';
|
||||
if (getJson.status_code > 1) {
|
||||
// if wrong api key error
|
||||
const error = 'tmdb get detail wrong api key error';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
else {
|
||||
const error = null;
|
||||
const result = getJson;
|
||||
cb(error, result);
|
||||
if (err) {
|
||||
// if thmdb api connection error
|
||||
const error = 'tmdb get detail api connection error';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
else {
|
||||
const error = null;
|
||||
const result = getJson;
|
||||
cb(error, result);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
const error = 'tmdb get detail api connection error';
|
||||
const result = null;
|
||||
cb(error, result);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user