diff options
Diffstat (limited to 'webapp/utils/web_client.jsx')
-rw-r--r-- | webapp/utils/web_client.jsx | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/webapp/utils/web_client.jsx b/webapp/utils/web_client.jsx index 642e523b7..b974ad31f 100644 --- a/webapp/utils/web_client.jsx +++ b/webapp/utils/web_client.jsx @@ -1,10 +1,12 @@ // Copyright (c) 2016 Mattermost, Inc. All Rights Reserved. // See License.txt for license information. -import Client from '../client/client.jsx'; +import Client from 'mattermost/client.jsx'; import TeamStore from '../stores/team_store.jsx'; import BrowserStore from '../stores/browser_store.jsx'; -import * as GlobalActions from 'action_creators/global_actions.jsx'; +import * as GlobalActions from 'actions/global_actions.jsx'; + +import request from 'superagent'; const HTTP_UNAUTHORIZED = 401; @@ -53,7 +55,7 @@ class WebClientClass extends Client { } }, (err) => { - this.track('api', 'api_users_login_fail', name, 'login_id', loginId); + this.track('api', 'api_users_login_fail', '', 'login_id', loginId); if (error) { error(err); } @@ -75,13 +77,24 @@ class WebClientClass extends Client { } }, (err) => { - this.track('api', 'api_users_login_fail', name, 'login_id', loginId); + this.track('api', 'api_users_login_fail', '', 'login_id', loginId); if (error) { error(err); } } ); } + + getYoutubeVideoInfo(googleKey, videoId, success, error) { + request.get('https://www.googleapis.com/youtube/v3/videos'). + query({part: 'snippet', id: videoId, key: googleKey}). + end((err, res) => { + if (err) { + return error(err); + } + return success(res.body); + }); + } } var WebClient = new WebClientClass(); |