{"action":"created","comment":{"url":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/comments/326848587","pull_request_review_id":291452313,"id":326848587,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyNjg0ODU4Nw==","diff_hunk":"@@ -1,32 +1,69 @@\n-var XMLHttpRequest = require(\"xmlhttprequest\").XMLHttpRequest;\n+const XMLHttpRequest = require(\"xmlhttprequest\").XMLHttpRequest;\n+\n+const URL_BASE = 'https://rickandmortyapi.com/api/character/';\n+const xhttp = new XMLHttpRequest();\n \n-var API = 'https://rickandmortyapi.com/api/character/';\n-var xhttp = new XMLHttpRequest();\n \n function fetchData(url_api, callback) {\n-  xhttp.onreadystatechange = function (event) {\n-    if (xhttp.readyState === '4') {\n-      if (xhttp.status == 200)\n-        callback(null, xhttp.responseText);\n-      else return callback(url_api);\n+  \n+  xhttp.onreadystatechange = event => {\n+\n+    if (xhttp.readyState === 4) {\n+\n+      if (xhttp.status === 200){\n+    \n+        let response = JSON.parse(xhttp.responseText)\n+        return callback(null, response);\n+      }\n+      else{\n+    \n+        return callback(url_api);\n+      }\n     }\n-  };\n-  xhttp.open('GET', url_api, false);\n+  }\n+  xhttp.open('GET', url_api, true);\n   xhttp.send();\n-};\n-\n-fetchData(API, function (error1, data1) {\n-  if (error1) return console.error('Error' + ' ' + error1);\n-  console.log('Primer Llamado...')\n-  fetchData(API + data1.results[0].id, function (error2, data2) {\n-    if (error2) return console.error(error1);\n-    console.log('Segundo Llamado...')\n-    fetchData(data2.origin.url, function (error3, data3) {\n-      if (error3) return console.error(error3);\n-      console.log('Tercero Llamado...')\n-      console.log('Personajes:' + ' ' + data1.info.count);\n-      console.log('Primer Personaje:' + ' ' + data2.name);\n-      console.log('Dimensión:' + ' ' + data3.dimension);\n-    });\n-  });\n-});\n\\ No newline at end of file\n+}\n+\n+const getCharacters = url => {\n+\n+  return new Promise((resolve, reject)=> {\n+    \n+    try{\n+      fetchData(url,function (error, data){","path":"src/index.js","position":61,"original_position":61,"commit_id":"ee3ac4beb9d6ac3e275fe3fb6766f2a0f31bf4fd","original_commit_id":"ee3ac4beb9d6ac3e275fe3fb6766f2a0f31bf4fd","user":{"login":"gndx","id":10554486,"node_id":"MDQ6VXNlcjEwNTU0NDg2","avatar_url":"https://avatars0.githubusercontent.com/u/10554486?v=4","gravatar_id":"","url":"https://api.github.com/users/gndx","html_url":"https://github.com/gndx","followers_url":"https://api.github.com/users/gndx/followers","following_url":"https://api.github.com/users/gndx/following{/other_user}","gists_url":"https://api.github.com/users/gndx/gists{/gist_id}","starred_url":"https://api.github.com/users/gndx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gndx/subscriptions","organizations_url":"https://api.github.com/users/gndx/orgs","repos_url":"https://api.github.com/users/gndx/repos","events_url":"https://api.github.com/users/gndx/events{/privacy}","received_events_url":"https://api.github.com/users/gndx/received_events","type":"User","site_admin":false},"body":"```suggestion\r\n      fetchData(url, (error, data) => {\r\n```","created_at":"2019-09-21T05:48:49Z","updated_at":"2019-09-21T05:49:35Z","html_url":"https://github.com/platzi/escuelajs-reto-03/pull/81#discussion_r326848587","pull_request_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/comments/326848587"},"html":{"href":"https://github.com/platzi/escuelajs-reto-03/pull/81#discussion_r326848587"},"pull_request":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81","id":319068489,"node_id":"MDExOlB1bGxSZXF1ZXN0MzE5MDY4NDg5","html_url":"https://github.com/platzi/escuelajs-reto-03/pull/81","diff_url":"https://github.com/platzi/escuelajs-reto-03/pull/81.diff","patch_url":"https://github.com/platzi/escuelajs-reto-03/pull/81.patch","issue_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/issues/81","number":81,"state":"open","locked":false,"title":"Solución al reto 3","user":{"login":"cosmosoftroot","id":28010872,"node_id":"MDQ6VXNlcjI4MDEwODcy","avatar_url":"https://avatars2.githubusercontent.com/u/28010872?v=4","gravatar_id":"","url":"https://api.github.com/users/cosmosoftroot","html_url":"https://github.com/cosmosoftroot","followers_url":"https://api.github.com/users/cosmosoftroot/followers","following_url":"https://api.github.com/users/cosmosoftroot/following{/other_user}","gists_url":"https://api.github.com/users/cosmosoftroot/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmosoftroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmosoftroot/subscriptions","organizations_url":"https://api.github.com/users/cosmosoftroot/orgs","repos_url":"https://api.github.com/users/cosmosoftroot/repos","events_url":"https://api.github.com/users/cosmosoftroot/events{/privacy}","received_events_url":"https://api.github.com/users/cosmosoftroot/received_events","type":"User","site_admin":false},"body":"## DESCRIPTION\r\n\r\nNombre: Iván Darío Sánchez\r\nUsuario Platzi: cosmosoftroot\r\n\r\n## Ciudad\r\n- [ ] Ciudad de México\r\n- [x] Bogotá\r\n\r\n# Retos:\r\n  - [x] Primer problema\r\n  - [x] Segundo problema\r\n  - [x] Tercer problema","created_at":"2019-09-19T02:30:47Z","updated_at":"2019-09-21T05:49:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"96ede3a5ef76fd647d531ee3a4e4d40a17d141d8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81/commits","review_comments_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81/comments","review_comment_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/comments{/number}","comments_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/issues/81/comments","statuses_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/statuses/ee3ac4beb9d6ac3e275fe3fb6766f2a0f31bf4fd","head":{"label":"cosmosoftroot:master","ref":"master","sha":"ee3ac4beb9d6ac3e275fe3fb6766f2a0f31bf4fd","user":{"login":"cosmosoftroot","id":28010872,"node_id":"MDQ6VXNlcjI4MDEwODcy","avatar_url":"https://avatars2.githubusercontent.com/u/28010872?v=4","gravatar_id":"","url":"https://api.github.com/users/cosmosoftroot","html_url":"https://github.com/cosmosoftroot","followers_url":"https://api.github.com/users/cosmosoftroot/followers","following_url":"https://api.github.com/users/cosmosoftroot/following{/other_user}","gists_url":"https://api.github.com/users/cosmosoftroot/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmosoftroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmosoftroot/subscriptions","organizations_url":"https://api.github.com/users/cosmosoftroot/orgs","repos_url":"https://api.github.com/users/cosmosoftroot/repos","events_url":"https://api.github.com/users/cosmosoftroot/events{/privacy}","received_events_url":"https://api.github.com/users/cosmosoftroot/received_events","type":"User","site_admin":false},"repo":{"id":208459721,"node_id":"MDEwOlJlcG9zaXRvcnkyMDg0NTk3MjE=","name":"escuelajs-reto-03","full_name":"cosmosoftroot/escuelajs-reto-03","private":false,"owner":{"login":"cosmosoftroot","id":28010872,"node_id":"MDQ6VXNlcjI4MDEwODcy","avatar_url":"https://avatars2.githubusercontent.com/u/28010872?v=4","gravatar_id":"","url":"https://api.github.com/users/cosmosoftroot","html_url":"https://github.com/cosmosoftroot","followers_url":"https://api.github.com/users/cosmosoftroot/followers","following_url":"https://api.github.com/users/cosmosoftroot/following{/other_user}","gists_url":"https://api.github.com/users/cosmosoftroot/gists{/gist_id}","starred_url":"https://api.github.com/users/cosmosoftroot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cosmosoftroot/subscriptions","organizations_url":"https://api.github.com/users/cosmosoftroot/orgs","repos_url":"https://api.github.com/users/cosmosoftroot/repos","events_url":"https://api.github.com/users/cosmosoftroot/events{/privacy}","received_events_url":"https://api.github.com/users/cosmosoftroot/received_events","type":"User","site_admin":false},"html_url":"https://github.com/cosmosoftroot/escuelajs-reto-03","description":"Reto 3 Septiembre 14: Curso de Fundamentos de JavaScript","fork":true,"url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03","forks_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/forks","keys_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/teams","hooks_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/hooks","issue_events_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/issues/events{/number}","events_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/events","assignees_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/assignees{/user}","branches_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/branches{/branch}","tags_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/tags","blobs_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/git/refs{/sha}","trees_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/statuses/{sha}","languages_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/languages","stargazers_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/stargazers","contributors_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/contributors","subscribers_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/subscribers","subscription_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/subscription","commits_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/commits{/sha}","git_commits_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/git/commits{/sha}","comments_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/comments{/number}","issue_comment_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/issues/comments{/number}","contents_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/contents/{+path}","compare_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/merges","archive_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/downloads","issues_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/issues{/number}","pulls_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/pulls{/number}","milestones_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/milestones{/number}","notifications_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/labels{/name}","releases_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/releases{/id}","deployments_url":"https://api.github.com/repos/cosmosoftroot/escuelajs-reto-03/deployments","created_at":"2019-09-14T15:26:15Z","updated_at":"2019-09-19T02:28:29Z","pushed_at":"2019-09-19T02:28:27Z","git_url":"git://github.com/cosmosoftroot/escuelajs-reto-03.git","ssh_url":"git@github.com:cosmosoftroot/escuelajs-reto-03.git","clone_url":"https://github.com/cosmosoftroot/escuelajs-reto-03.git","svn_url":"https://github.com/cosmosoftroot/escuelajs-reto-03","homepage":"https://platzi.com","size":6,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"platzi:master","ref":"master","sha":"eb2b1da9a514bf06621cef6db0b6d05a190ba77f","user":{"login":"platzi","id":2975064,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzUwNjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2975064?v=4","gravatar_id":"","url":"https://api.github.com/users/platzi","html_url":"https://github.com/platzi","followers_url":"https://api.github.com/users/platzi/followers","following_url":"https://api.github.com/users/platzi/following{/other_user}","gists_url":"https://api.github.com/users/platzi/gists{/gist_id}","starred_url":"https://api.github.com/users/platzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platzi/subscriptions","organizations_url":"https://api.github.com/users/platzi/orgs","repos_url":"https://api.github.com/users/platzi/repos","events_url":"https://api.github.com/users/platzi/events{/privacy}","received_events_url":"https://api.github.com/users/platzi/received_events","type":"Organization","site_admin":false},"repo":{"id":208140665,"node_id":"MDEwOlJlcG9zaXRvcnkyMDgxNDA2NjU=","name":"escuelajs-reto-03","full_name":"platzi/escuelajs-reto-03","private":false,"owner":{"login":"platzi","id":2975064,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI5NzUwNjQ=","avatar_url":"https://avatars0.githubusercontent.com/u/2975064?v=4","gravatar_id":"","url":"https://api.github.com/users/platzi","html_url":"https://github.com/platzi","followers_url":"https://api.github.com/users/platzi/followers","following_url":"https://api.github.com/users/platzi/following{/other_user}","gists_url":"https://api.github.com/users/platzi/gists{/gist_id}","starred_url":"https://api.github.com/users/platzi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/platzi/subscriptions","organizations_url":"https://api.github.com/users/platzi/orgs","repos_url":"https://api.github.com/users/platzi/repos","events_url":"https://api.github.com/users/platzi/events{/privacy}","received_events_url":"https://api.github.com/users/platzi/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/platzi/escuelajs-reto-03","description":"Reto 3 Septiembre 14: Curso de Fundamentos de JavaScript","fork":false,"url":"https://api.github.com/repos/platzi/escuelajs-reto-03","forks_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/forks","keys_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/keys{/key_id}","collaborators_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/teams","hooks_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/hooks","issue_events_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/issues/events{/number}","events_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/events","assignees_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/assignees{/user}","branches_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/branches{/branch}","tags_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/tags","blobs_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/git/refs{/sha}","trees_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/git/trees{/sha}","statuses_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/statuses/{sha}","languages_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/languages","stargazers_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/stargazers","contributors_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/contributors","subscribers_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/subscribers","subscription_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/subscription","commits_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/commits{/sha}","git_commits_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/git/commits{/sha}","comments_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/comments{/number}","issue_comment_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/issues/comments{/number}","contents_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/contents/{+path}","compare_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/compare/{base}...{head}","merges_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/merges","archive_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/downloads","issues_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/issues{/number}","pulls_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls{/number}","milestones_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/milestones{/number}","notifications_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/labels{/name}","releases_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/releases{/id}","deployments_url":"https://api.github.com/repos/platzi/escuelajs-reto-03/deployments","created_at":"2019-09-12T20:28:07Z","updated_at":"2019-09-19T18:33:25Z","pushed_at":"2019-09-21T05:13:04Z","git_url":"git://github.com/platzi/escuelajs-reto-03.git","ssh_url":"git@github.com:platzi/escuelajs-reto-03.git","clone_url":"https://github.com/platzi/escuelajs-reto-03.git","svn_url":"https://github.com/platzi/escuelajs-reto-03","homepage":"https://platzi.com","size":5,"stargazers_count":6,"watchers_count":6,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":138,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":99,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":138,"open_issues":99,"watchers":6,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81"},"html":{"href":"https://github.com/platzi/escuelajs-reto-03/pull/81"},"issue":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/issues/81"},"comments":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/platzi/escuelajs-reto-03/statuses/ee3ac4beb9d6ac3e275fe3fb6766f2a0f31bf4fd"}},"author_association":"NONE"}}
{"actor":{"display_login":"gndx"}}