Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1838)

Unified Diff: remoting/webapp/crd/js/host_list_api_impl.js

Issue 1111603002: Added ability to register new hosts using GCD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@host-list-delete
Patch Set: unit test fix Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/webapp/crd/js/host_list_api_impl.js
diff --git a/remoting/webapp/crd/js/host_list_api_impl.js b/remoting/webapp/crd/js/host_list_api_impl.js
index 542e3f0e9d68e3f9ef8cd10101963cd644d444d2..5463d61ef01dba7867b3fb8481f2b5fb577487c5 100644
--- a/remoting/webapp/crd/js/host_list_api_impl.js
+++ b/remoting/webapp/crd/js/host_list_api_impl.js
@@ -41,12 +41,10 @@ remoting.HostListApiImpl.prototype.register = function(
useIdentity: true
}).start().then(function(response) {
if (response.status == 200) {
- var result = response.getJson();
- if (result['data']) {
- return base.getStringAttr(result['data'], 'authorizationCode', '');
- } else {
- return '';
- }
+ var result = /** @type {!Object} */ (response.getJson());
+ var data = base.getObjectAttr(result, 'data');
+ var authCode = base.getStringAttr(data, 'authorizationCode');
+ return { authCode: authCode, email: '' };
} else {
console.log(
'Failed to register the host. Status: ' + response.status +
« no previous file with comments | « remoting/webapp/crd/js/host_list_api_gcd_impl.js ('k') | remoting/webapp/crd/js/host_list_api_impl_unittest.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698