From f31c0d97f9f59371d90d1396469aa9569933fb0d Mon Sep 17 00:00:00 2001 From: Mohammad Amoush Date: Thu, 27 Jun 2019 12:55:31 -0400 Subject: Youtube Results Showing as List Implemented --- src/server/index.ts | 4 ++-- src/server/youtubeApi/youtubeApiSample.js | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/server') 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 -- cgit v1.2.3-70-g09d2