{"action":"created","comment":{"url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/comments/138660583","pull_request_review_id":62485900,"id":138660583,"diff_hunk":"@@ -0,0 +1,85 @@\n+// Файл backend.js - модуль для работы с сервером\n+'use strict';\n+\n+(function () {\n+  // сервер, на который должны отправиться данные\n+  var SERVER_URL = 'https://1510.dump.academy/kekstagram';\n+\n+  // настройкой запроса, логика связанная с работой по сети\n+  var setup = function (onLoad, onError) {\n+\n+    // новый запрос к серверу\n+    var xhr = new XMLHttpRequest();\n+\n+    // для того чтобы xhr.response сразу вернул объект или массив\n+    xhr.responseType = 'json';\n+\n+    // если данные загружены успешно выполнится onLoad\n+    // и onError, если что-то пошло не так\n+    xhr.addEventListener('load', function () {\n+      try {\n+        onLoad(xhr.response);\n+      } catch (err) {\n+        onError(err.message);\n+      }\n+    });\n+\n+    // обработка ошибочных ситуаций\n+    xhr.addEventListener('error', function () {\n+      onError('Произошла ошибка соединения');\n+    });\n+\n+    xhr.addEventListener('timeout', function () {\n+      onError('Запрос не успел выполниться за ' + xhr.timeout + 'мс');\n+    });\n+\n+    xhr.timeout = 10000;// 10s\n+\n+    return xhr;\n+  };\n+\n+  window.backend = {\n+    // получение данных с сервера с методом POST на адрес SERVER_URL\n+    // функция onLoad, если данные отправлены успешно\n+    // onError, если - ошибка\n+    load: function (onLoad, onError) {\n+      var xhr = setup(onLoad, onError);\n+\n+      // запрос к серверу\n+      xhr.open('GET', SERVER_URL + '/data');\n+      xhr.send();\n+    },\n+\n+    // функция загрузки данных на сервер\n+    // объект с данными, которые необходимо отправить data\n+    // функцию обратного вызова onLoad, если данные отправлены успешно\n+    // onError, если - ошибка\n+    save: function (data, onLoad, onError) {\n+      var xhr = setup(onLoad, onError);\n+\n+      // запрос к серверу\n+      xhr.open('POST', SERVER_URL);\n+      xhr.send(data);\n+    },\n+\n+    // сообщение об ошибках\n+    onLoadError: function (errorMessage) {\n+      var node = document.createElement('div');","path":"js/backend.js","position":67,"original_position":67,"commit_id":"f0f8815e23661ea24941fe0e37994f4e64f8c391","original_commit_id":"f0f8815e23661ea24941fe0e37994f4e64f8c391","user":{"login":"IerominSergii","id":28700781,"avatar_url":"https://avatars0.githubusercontent.com/u/28700781?v=4","gravatar_id":"","url":"https://api.github.com/users/IerominSergii","html_url":"https://github.com/IerominSergii","followers_url":"https://api.github.com/users/IerominSergii/followers","following_url":"https://api.github.com/users/IerominSergii/following{/other_user}","gists_url":"https://api.github.com/users/IerominSergii/gists{/gist_id}","starred_url":"https://api.github.com/users/IerominSergii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IerominSergii/subscriptions","organizations_url":"https://api.github.com/users/IerominSergii/orgs","repos_url":"https://api.github.com/users/IerominSergii/repos","events_url":"https://api.github.com/users/IerominSergii/events{/privacy}","received_events_url":"https://api.github.com/users/IerominSergii/received_events","type":"User","site_admin":false},"body":"заменил \"node\"  на \"errorPopup\"","created_at":"2017-09-13T15:47:51Z","updated_at":"2017-09-13T15:47:52Z","html_url":"https://github.com/htmlacademy-javascript/380133-kekstagram/pull/9#discussion_r138660583","pull_request_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/comments/138660583"},"html":{"href":"https://github.com/htmlacademy-javascript/380133-kekstagram/pull/9#discussion_r138660583"},"pull_request":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9"}},"in_reply_to_id":138622071},"pull_request":{"url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9","id":140558703,"html_url":"https://github.com/htmlacademy-javascript/380133-kekstagram/pull/9","diff_url":"https://github.com/htmlacademy-javascript/380133-kekstagram/pull/9.diff","patch_url":"https://github.com/htmlacademy-javascript/380133-kekstagram/pull/9.patch","issue_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/issues/9","number":9,"state":"open","locked":false,"title":"Личный проект: надо подкачаться","user":{"login":"IerominSergii","id":28700781,"avatar_url":"https://avatars0.githubusercontent.com/u/28700781?v=4","gravatar_id":"","url":"https://api.github.com/users/IerominSergii","html_url":"https://github.com/IerominSergii","followers_url":"https://api.github.com/users/IerominSergii/followers","following_url":"https://api.github.com/users/IerominSergii/following{/other_user}","gists_url":"https://api.github.com/users/IerominSergii/gists{/gist_id}","starred_url":"https://api.github.com/users/IerominSergii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IerominSergii/subscriptions","organizations_url":"https://api.github.com/users/IerominSergii/orgs","repos_url":"https://api.github.com/users/IerominSergii/repos","events_url":"https://api.github.com/users/IerominSergii/events{/privacy}","received_events_url":"https://api.github.com/users/IerominSergii/received_events","type":"User","site_admin":false},"body":"1. Создайте модуль backend.js, который экспортирует в глобальную область видимости функции backend.load и backend.save, которые будут работать с сервером данных.\r\n2. Подключите модуль backend.js в index.html\r\n3. Доработайте модуль для отрисовки фотографий\r\n4. Доработайте обработчик отправки формы\r\n5. Добавьте обработку возможных ошибок при загрузке: создайте DOM-элемент, который будет показывать сообщения об ошибках\r\n\r\n---\r\n:mortar_board: [Личный проект: надо подкачаться](https://up.htmlacademy.ru/javascript/10/user/380133/tasks/20)\r\n\r\n:boom: https://htmlacademy-javascript.github.io/380133-kekstagram/9/","created_at":"2017-09-12T11:51:42Z","updated_at":"2017-09-13T15:47:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"78b633181462a3a406f2e798107e48bcc5925d5a","assignee":{"login":"BekoBou","id":128654,"avatar_url":"https://avatars3.githubusercontent.com/u/128654?v=4","gravatar_id":"","url":"https://api.github.com/users/BekoBou","html_url":"https://github.com/BekoBou","followers_url":"https://api.github.com/users/BekoBou/followers","following_url":"https://api.github.com/users/BekoBou/following{/other_user}","gists_url":"https://api.github.com/users/BekoBou/gists{/gist_id}","starred_url":"https://api.github.com/users/BekoBou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BekoBou/subscriptions","organizations_url":"https://api.github.com/users/BekoBou/orgs","repos_url":"https://api.github.com/users/BekoBou/repos","events_url":"https://api.github.com/users/BekoBou/events{/privacy}","received_events_url":"https://api.github.com/users/BekoBou/received_events","type":"User","site_admin":false},"assignees":[{"login":"BekoBou","id":128654,"avatar_url":"https://avatars3.githubusercontent.com/u/128654?v=4","gravatar_id":"","url":"https://api.github.com/users/BekoBou","html_url":"https://github.com/BekoBou","followers_url":"https://api.github.com/users/BekoBou/followers","following_url":"https://api.github.com/users/BekoBou/following{/other_user}","gists_url":"https://api.github.com/users/BekoBou/gists{/gist_id}","starred_url":"https://api.github.com/users/BekoBou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BekoBou/subscriptions","organizations_url":"https://api.github.com/users/BekoBou/orgs","repos_url":"https://api.github.com/users/BekoBou/repos","events_url":"https://api.github.com/users/BekoBou/events{/privacy}","received_events_url":"https://api.github.com/users/BekoBou/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9/commits","review_comments_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9/comments","review_comment_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/comments{/number}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/issues/9/comments","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/statuses/f0f8815e23661ea24941fe0e37994f4e64f8c391","head":{"label":"IerominSergii:module6-task1","ref":"module6-task1","sha":"f0f8815e23661ea24941fe0e37994f4e64f8c391","user":{"login":"IerominSergii","id":28700781,"avatar_url":"https://avatars0.githubusercontent.com/u/28700781?v=4","gravatar_id":"","url":"https://api.github.com/users/IerominSergii","html_url":"https://github.com/IerominSergii","followers_url":"https://api.github.com/users/IerominSergii/followers","following_url":"https://api.github.com/users/IerominSergii/following{/other_user}","gists_url":"https://api.github.com/users/IerominSergii/gists{/gist_id}","starred_url":"https://api.github.com/users/IerominSergii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IerominSergii/subscriptions","organizations_url":"https://api.github.com/users/IerominSergii/orgs","repos_url":"https://api.github.com/users/IerominSergii/repos","events_url":"https://api.github.com/users/IerominSergii/events{/privacy}","received_events_url":"https://api.github.com/users/IerominSergii/received_events","type":"User","site_admin":false},"repo":{"id":99743229,"name":"380133-kekstagram","full_name":"IerominSergii/380133-kekstagram","owner":{"login":"IerominSergii","id":28700781,"avatar_url":"https://avatars0.githubusercontent.com/u/28700781?v=4","gravatar_id":"","url":"https://api.github.com/users/IerominSergii","html_url":"https://github.com/IerominSergii","followers_url":"https://api.github.com/users/IerominSergii/followers","following_url":"https://api.github.com/users/IerominSergii/following{/other_user}","gists_url":"https://api.github.com/users/IerominSergii/gists{/gist_id}","starred_url":"https://api.github.com/users/IerominSergii/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/IerominSergii/subscriptions","organizations_url":"https://api.github.com/users/IerominSergii/orgs","repos_url":"https://api.github.com/users/IerominSergii/repos","events_url":"https://api.github.com/users/IerominSergii/events{/privacy}","received_events_url":"https://api.github.com/users/IerominSergii/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/IerominSergii/380133-kekstagram","description":"Sergii Yeromin","fork":true,"url":"https://api.github.com/repos/IerominSergii/380133-kekstagram","forks_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/forks","keys_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/teams","hooks_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/hooks","issue_events_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/issues/events{/number}","events_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/events","assignees_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/assignees{/user}","branches_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/branches{/branch}","tags_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/tags","blobs_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/statuses/{sha}","languages_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/languages","stargazers_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/stargazers","contributors_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/contributors","subscribers_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/subscribers","subscription_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/subscription","commits_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/issues/comments{/number}","contents_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/contents/{+path}","compare_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/merges","archive_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/downloads","issues_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/issues{/number}","pulls_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/pulls{/number}","milestones_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/milestones{/number}","notifications_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/labels{/name}","releases_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/releases{/id}","deployments_url":"https://api.github.com/repos/IerominSergii/380133-kekstagram/deployments","created_at":"2017-08-08T22:58:35Z","updated_at":"2017-09-05T09:14:10Z","pushed_at":"2017-09-13T07:42:30Z","git_url":"git://github.com/IerominSergii/380133-kekstagram.git","ssh_url":"git@github.com:IerominSergii/380133-kekstagram.git","clone_url":"https://github.com/IerominSergii/380133-kekstagram.git","svn_url":"https://github.com/IerominSergii/380133-kekstagram","homepage":null,"size":4427,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"htmlacademy-javascript:master","ref":"master","sha":"204c51f457d3d76bfbd851f0825adec7c2a59cd0","user":{"login":"htmlacademy-javascript","id":14179712,"avatar_url":"https://avatars2.githubusercontent.com/u/14179712?v=4","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-javascript","html_url":"https://github.com/htmlacademy-javascript","followers_url":"https://api.github.com/users/htmlacademy-javascript/followers","following_url":"https://api.github.com/users/htmlacademy-javascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-javascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-javascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-javascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-javascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-javascript/repos","events_url":"https://api.github.com/users/htmlacademy-javascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-javascript/received_events","type":"Organization","site_admin":false},"repo":{"id":99728328,"name":"380133-kekstagram","full_name":"htmlacademy-javascript/380133-kekstagram","owner":{"login":"htmlacademy-javascript","id":14179712,"avatar_url":"https://avatars2.githubusercontent.com/u/14179712?v=4","gravatar_id":"","url":"https://api.github.com/users/htmlacademy-javascript","html_url":"https://github.com/htmlacademy-javascript","followers_url":"https://api.github.com/users/htmlacademy-javascript/followers","following_url":"https://api.github.com/users/htmlacademy-javascript/following{/other_user}","gists_url":"https://api.github.com/users/htmlacademy-javascript/gists{/gist_id}","starred_url":"https://api.github.com/users/htmlacademy-javascript/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/htmlacademy-javascript/subscriptions","organizations_url":"https://api.github.com/users/htmlacademy-javascript/orgs","repos_url":"https://api.github.com/users/htmlacademy-javascript/repos","events_url":"https://api.github.com/users/htmlacademy-javascript/events{/privacy}","received_events_url":"https://api.github.com/users/htmlacademy-javascript/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/htmlacademy-javascript/380133-kekstagram","description":"Sergii Yeromin","fork":false,"url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram","forks_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/forks","keys_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/keys{/key_id}","collaborators_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/teams","hooks_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/hooks","issue_events_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/issues/events{/number}","events_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/events","assignees_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/assignees{/user}","branches_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/branches{/branch}","tags_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/tags","blobs_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/git/refs{/sha}","trees_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/git/trees{/sha}","statuses_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/statuses/{sha}","languages_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/languages","stargazers_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/stargazers","contributors_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/contributors","subscribers_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/subscribers","subscription_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/subscription","commits_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/commits{/sha}","git_commits_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/git/commits{/sha}","comments_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/comments{/number}","issue_comment_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/issues/comments{/number}","contents_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/contents/{+path}","compare_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/compare/{base}...{head}","merges_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/merges","archive_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/downloads","issues_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/issues{/number}","pulls_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls{/number}","milestones_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/milestones{/number}","notifications_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/labels{/name}","releases_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/releases{/id}","deployments_url":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/deployments","created_at":"2017-08-08T19:23:05Z","updated_at":"2017-09-04T10:46:28Z","pushed_at":"2017-09-13T07:42:32Z","git_url":"git://github.com/htmlacademy-javascript/380133-kekstagram.git","ssh_url":"git@github.com:htmlacademy-javascript/380133-kekstagram.git","clone_url":"https://github.com/htmlacademy-javascript/380133-kekstagram.git","svn_url":"https://github.com/htmlacademy-javascript/380133-kekstagram","homepage":"https://github.com/IerominSergii/380133-kekstagram","size":4405,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","has_issues":false,"has_projects":true,"has_downloads":false,"has_wiki":false,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":1,"forks":1,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9"},"html":{"href":"https://github.com/htmlacademy-javascript/380133-kekstagram/pull/9"},"issue":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/issues/9"},"comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/issues/9/comments"},"review_comments":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9/comments"},"review_comment":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/pulls/9/commits"},"statuses":{"href":"https://api.github.com/repos/htmlacademy-javascript/380133-kekstagram/statuses/f0f8815e23661ea24941fe0e37994f4e64f8c391"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"IerominSergii"}}