Now can handle type selector aswell

This commit is contained in:
2017-04-21 16:59:07 +02:00
parent cbe06abf88
commit 76d39416a1

View File

@@ -6,10 +6,10 @@ class TMDB {
this.tmdbLibrary = tmdbLibrary || moviedb(apiKey); this.tmdbLibrary = tmdbLibrary || moviedb(apiKey);
} }
search(text, page = 1) { search(text, page = 1, type = 'searchMulti') {
const query = { query: text, page }; const query = { query: text, page };
return Promise.resolve() return Promise.resolve()
.then(() => this.tmdb('searchMulti', query)) .then(() => this.tmdb(type, query))
.catch(() => { throw new Error('Could not search for movies.'); }) .catch(() => { throw new Error('Could not search for movies.'); })
.then((reponse) => { .then((reponse) => {
try { try {