aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorMohammad Amoush <mohammad_amoush@brown.edu>2019-06-27 12:55:31 -0400
committerMohammad Amoush <mohammad_amoush@brown.edu>2019-06-27 12:55:31 -0400
commitf31c0d97f9f59371d90d1396469aa9569933fb0d (patch)
tree5a64328ef6361bda1237e5588db395d698f1f210 /src/server
parent21bc14319013e4757ca24f56a685b7d75eaa259a (diff)
Youtube Results Showing as List Implemented
Diffstat (limited to 'src/server')
-rw-r--r--src/server/index.ts4
-rw-r--r--src/server/youtubeApi/youtubeApiSample.js5
2 files changed, 5 insertions, 4 deletions
diff --git a/src/server/index.ts b/src/server/index.ts
index 9faeee381..9e4ad9d86 100644
--- a/src/server/index.ts
+++ b/src/server/index.ts
@@ -367,13 +367,13 @@ function GetRefFields([ids, callback]: [string[], (result?: Transferable[]) => v
Database.Instance.getDocuments(ids, callback, "newDocuments");
}
-function HandleYoutubeQuery([query, callback]: [YoutubeQueryInput, (result?: string) => void]) {
+function HandleYoutubeQuery([query, callback]: [YoutubeQueryInput, (result?: any[]) => void]) {
switch (query.type) {
case YoutubeQueryType.Channels:
YoutubeApi.authorizedGetChannel(youtubeApiKey);
break;
case YoutubeQueryType.SearchVideo:
- YoutubeApi.authorizedGetVideos(youtubeApiKey, query.userInput);
+ YoutubeApi.authorizedGetVideos(youtubeApiKey, query.userInput, callback);
}
}
diff --git a/src/server/youtubeApi/youtubeApiSample.js b/src/server/youtubeApi/youtubeApiSample.js
index cd2e89cae..e95f99015 100644
--- a/src/server/youtubeApi/youtubeApiSample.js
+++ b/src/server/youtubeApi/youtubeApiSample.js
@@ -29,8 +29,8 @@ module.exports.authorizedGetChannel = (apiKey) => {
authorize(JSON.parse(apiKey), getChannel);
}
-module.exports.authorizedGetVideos = (apiKey, userInput) => {
- authorize(JSON.parse(apiKey), getSampleVideos, { userInput: userInput });
+module.exports.authorizedGetVideos = (apiKey, userInput, callBack) => {
+ authorize(JSON.parse(apiKey), getSampleVideos, { userInput: userInput, callBack: callBack });
}
@@ -154,5 +154,6 @@ function getSampleVideos(auth, args) {
}
let videos = response.data.items;
console.log('Videos found: ' + videos[0].id.videoId, " ", videos[0].snippet.title);
+ args.callBack(videos);
});
} \ No newline at end of file