aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
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