{"action":"created","comment":{"url":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments/76683036","id":76683036,"diff_hunk":"@@ -137,29 +106,45 @@ class ApiClient {\n   post(path, body = {}) {\n     const url = `${this.url}${path}`;\n \n-    // @TODO: little experiment with console output for providing more information when\n-    // API events are happening. console.log() statement are stripped on Prod builds.\n-    // Might be useful to have a set of defined styles on a JS object that can be passed\n-    // through: warning, notice, succes, etc...\n-    console.log('%c ApiClient POST Request Body: \\n' + JSON.stringify(body),\n-      'background-color: rgba(105,157,215,0.5); color: rgba(33,70,112,1); line-height: 1.5;'\n-    );\n-\n-    return window.fetch(url, {\n-      method: 'POST',\n-      headers: this.headers,\n-      credentials: 'same-origin',\n+    return this.send('POST', url, {\n       body: JSON.stringify(body)\n-    })\n-      .then(this.checkStatus)\n-      .then(this.parseJson)\n-      .then(function(response) {\n-        return response;\n     });\n   }\n \n-  send() {\n-    // @TODO: setup this send method that all other request methods call.\n+  /**\n+   * Send an API request using fetch() and return response.\n+   *\n+   * @param  {String} method\n+   * @param  {String} url\n+   * @param  {Object} options\n+   * @return {Promise}\n+   */\n+  send(method, url, options = {}) {\n+    const defaults = {\n+      method: method,\n+      headers: this.headers,\n+      credentials: 'same-origin'","path":"lib/themes/dosomething/paraneue_dosomething/js/utilities/ApiClient.js","position":104,"original_position":104,"commit_id":"1ee10e66fb50ad33760f74b1c01fd91473090c62","original_commit_id":"1ee10e66fb50ad33760f74b1c01fd91473090c62","user":{"login":"weerd","id":105849,"avatar_url":"https://avatars.githubusercontent.com/u/105849?v=3","gravatar_id":"","url":"https://api.github.com/users/weerd","html_url":"https://github.com/weerd","followers_url":"https://api.github.com/users/weerd/followers","following_url":"https://api.github.com/users/weerd/following{/other_user}","gists_url":"https://api.github.com/users/weerd/gists{/gist_id}","starred_url":"https://api.github.com/users/weerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weerd/subscriptions","organizations_url":"https://api.github.com/users/weerd/orgs","repos_url":"https://api.github.com/users/weerd/repos","events_url":"https://api.github.com/users/weerd/events{/privacy}","received_events_url":"https://api.github.com/users/weerd/received_events","type":"User","site_admin":false},"body":"Yeah, with switching to Lodash's `defaults()`, it should allow overriding items you pass in.","created_at":"2016-08-29T20:42:21Z","updated_at":"2016-08-29T20:42:21Z","html_url":"https://github.com/DoSomething/phoenix/pull/6968#discussion_r76683036","pull_request_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968","_links":{"self":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments/76683036"},"html":{"href":"https://github.com/DoSomething/phoenix/pull/6968#discussion_r76683036"},"pull_request":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968"}}},"pull_request":{"url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968","id":83160480,"html_url":"https://github.com/DoSomething/phoenix/pull/6968","diff_url":"https://github.com/DoSomething/phoenix/pull/6968.diff","patch_url":"https://github.com/DoSomething/phoenix/pull/6968.patch","issue_url":"https://api.github.com/repos/DoSomething/phoenix/issues/6968","number":6968,"state":"open","locked":false,"title":"DELETE all the code!! And replace with a bit of less, yet better code!","user":{"login":"weerd","id":105849,"avatar_url":"https://avatars.githubusercontent.com/u/105849?v=3","gravatar_id":"","url":"https://api.github.com/users/weerd","html_url":"https://github.com/weerd","followers_url":"https://api.github.com/users/weerd/followers","following_url":"https://api.github.com/users/weerd/following{/other_user}","gists_url":"https://api.github.com/users/weerd/gists{/gist_id}","starred_url":"https://api.github.com/users/weerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weerd/subscriptions","organizations_url":"https://api.github.com/users/weerd/orgs","repos_url":"https://api.github.com/users/weerd/repos","events_url":"https://api.github.com/users/weerd/events{/privacy}","received_events_url":"https://api.github.com/users/weerd/received_events","type":"User","site_admin":false},"body":"#### What's this PR do?\r\nThis PR DRYs up the request methods in the `ApiClient` class in JS, so that they all send their requests through the new `send()` method. This will help keeps things cleaner and easier to manage in the class. It also update the console output for development purposes when a request is made via the class.\r\n\r\nExample in the console on development only:\r\n<img width=\"928\" alt=\"screen shot 2016-08-29 at 4 18 59 pm\" src=\"https://cloud.githubusercontent.com/assets/105849/18065997/61f932cc-6e04-11e6-8a6c-12a28fe0946f.png\">\r\n\r\nThis PR also moves the `whatwg-fetch` polyfill library out of the webpack config and into **libs.js**.\r\n\r\n#### How should this be reviewed?\r\n👀 do API calls happening in the Onboarding experience still work?!?\r\n\r\n#### Relevant tickets\r\nFixes #6954\r\nFixes: 💅 \r\n\r\n#### Checklist\r\n- [ ] Tested on staging.\r\n\r\n---\r\n@DFurnes @deadlybutter \r\n\r\ncc: @jessleenyc \r\n","created_at":"2016-08-29T20:18:29Z","updated_at":"2016-08-29T20:42:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"0f1fef4c73e59d824b479f68010ae25b3a00900b","assignee":{"login":"DFurnes","id":583202,"avatar_url":"https://avatars.githubusercontent.com/u/583202?v=3","gravatar_id":"","url":"https://api.github.com/users/DFurnes","html_url":"https://github.com/DFurnes","followers_url":"https://api.github.com/users/DFurnes/followers","following_url":"https://api.github.com/users/DFurnes/following{/other_user}","gists_url":"https://api.github.com/users/DFurnes/gists{/gist_id}","starred_url":"https://api.github.com/users/DFurnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFurnes/subscriptions","organizations_url":"https://api.github.com/users/DFurnes/orgs","repos_url":"https://api.github.com/users/DFurnes/repos","events_url":"https://api.github.com/users/DFurnes/events{/privacy}","received_events_url":"https://api.github.com/users/DFurnes/received_events","type":"User","site_admin":false},"assignees":[{"login":"DFurnes","id":583202,"avatar_url":"https://avatars.githubusercontent.com/u/583202?v=3","gravatar_id":"","url":"https://api.github.com/users/DFurnes","html_url":"https://github.com/DFurnes","followers_url":"https://api.github.com/users/DFurnes/followers","following_url":"https://api.github.com/users/DFurnes/following{/other_user}","gists_url":"https://api.github.com/users/DFurnes/gists{/gist_id}","starred_url":"https://api.github.com/users/DFurnes/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DFurnes/subscriptions","organizations_url":"https://api.github.com/users/DFurnes/orgs","repos_url":"https://api.github.com/users/DFurnes/repos","events_url":"https://api.github.com/users/DFurnes/events{/privacy}","received_events_url":"https://api.github.com/users/DFurnes/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968/commits","review_comments_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968/comments","review_comment_url":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments{/number}","comments_url":"https://api.github.com/repos/DoSomething/phoenix/issues/6968/comments","statuses_url":"https://api.github.com/repos/DoSomething/phoenix/statuses/1ee10e66fb50ad33760f74b1c01fd91473090c62","head":{"label":"DoSomething:js-api-client-updates","ref":"js-api-client-updates","sha":"1ee10e66fb50ad33760f74b1c01fd91473090c62","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":13592927,"name":"phoenix","full_name":"DoSomething/phoenix","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/phoenix","description":":fire: The DoSomething.org website & content API.","fork":false,"url":"https://api.github.com/repos/DoSomething/phoenix","forks_url":"https://api.github.com/repos/DoSomething/phoenix/forks","keys_url":"https://api.github.com/repos/DoSomething/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/phoenix/teams","hooks_url":"https://api.github.com/repos/DoSomething/phoenix/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/phoenix/events","assignees_url":"https://api.github.com/repos/DoSomething/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/phoenix/tags","blobs_url":"https://api.github.com/repos/DoSomething/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/phoenix/languages","stargazers_url":"https://api.github.com/repos/DoSomething/phoenix/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/phoenix/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/phoenix/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/phoenix/subscription","commits_url":"https://api.github.com/repos/DoSomething/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/phoenix/merges","archive_url":"https://api.github.com/repos/DoSomething/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/phoenix/downloads","issues_url":"https://api.github.com/repos/DoSomething/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/DoSomething/phoenix/deployments","created_at":"2013-10-15T14:50:48Z","updated_at":"2016-07-06T20:16:27Z","pushed_at":"2016-08-29T20:35:22Z","git_url":"git://github.com/DoSomething/phoenix.git","ssh_url":"git@github.com:DoSomething/phoenix.git","clone_url":"https://github.com/DoSomething/phoenix.git","svn_url":"https://github.com/DoSomething/phoenix","homepage":"http://www.dosomething.org/","size":20556,"stargazers_count":28,"watchers_count":28,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":101,"forks":20,"open_issues":101,"watchers":28,"default_branch":"dev"}},"base":{"label":"DoSomething:dev","ref":"dev","sha":"eb82da79426d10156ef0ea36baa560a6a7fc27e1","user":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"repo":{"id":13592927,"name":"phoenix","full_name":"DoSomething/phoenix","owner":{"login":"DoSomething","id":731685,"avatar_url":"https://avatars.githubusercontent.com/u/731685?v=3","gravatar_id":"","url":"https://api.github.com/users/DoSomething","html_url":"https://github.com/DoSomething","followers_url":"https://api.github.com/users/DoSomething/followers","following_url":"https://api.github.com/users/DoSomething/following{/other_user}","gists_url":"https://api.github.com/users/DoSomething/gists{/gist_id}","starred_url":"https://api.github.com/users/DoSomething/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/DoSomething/subscriptions","organizations_url":"https://api.github.com/users/DoSomething/orgs","repos_url":"https://api.github.com/users/DoSomething/repos","events_url":"https://api.github.com/users/DoSomething/events{/privacy}","received_events_url":"https://api.github.com/users/DoSomething/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/DoSomething/phoenix","description":":fire: The DoSomething.org website & content API.","fork":false,"url":"https://api.github.com/repos/DoSomething/phoenix","forks_url":"https://api.github.com/repos/DoSomething/phoenix/forks","keys_url":"https://api.github.com/repos/DoSomething/phoenix/keys{/key_id}","collaborators_url":"https://api.github.com/repos/DoSomething/phoenix/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/DoSomething/phoenix/teams","hooks_url":"https://api.github.com/repos/DoSomething/phoenix/hooks","issue_events_url":"https://api.github.com/repos/DoSomething/phoenix/issues/events{/number}","events_url":"https://api.github.com/repos/DoSomething/phoenix/events","assignees_url":"https://api.github.com/repos/DoSomething/phoenix/assignees{/user}","branches_url":"https://api.github.com/repos/DoSomething/phoenix/branches{/branch}","tags_url":"https://api.github.com/repos/DoSomething/phoenix/tags","blobs_url":"https://api.github.com/repos/DoSomething/phoenix/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/DoSomething/phoenix/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/DoSomething/phoenix/git/refs{/sha}","trees_url":"https://api.github.com/repos/DoSomething/phoenix/git/trees{/sha}","statuses_url":"https://api.github.com/repos/DoSomething/phoenix/statuses/{sha}","languages_url":"https://api.github.com/repos/DoSomething/phoenix/languages","stargazers_url":"https://api.github.com/repos/DoSomething/phoenix/stargazers","contributors_url":"https://api.github.com/repos/DoSomething/phoenix/contributors","subscribers_url":"https://api.github.com/repos/DoSomething/phoenix/subscribers","subscription_url":"https://api.github.com/repos/DoSomething/phoenix/subscription","commits_url":"https://api.github.com/repos/DoSomething/phoenix/commits{/sha}","git_commits_url":"https://api.github.com/repos/DoSomething/phoenix/git/commits{/sha}","comments_url":"https://api.github.com/repos/DoSomething/phoenix/comments{/number}","issue_comment_url":"https://api.github.com/repos/DoSomething/phoenix/issues/comments{/number}","contents_url":"https://api.github.com/repos/DoSomething/phoenix/contents/{+path}","compare_url":"https://api.github.com/repos/DoSomething/phoenix/compare/{base}...{head}","merges_url":"https://api.github.com/repos/DoSomething/phoenix/merges","archive_url":"https://api.github.com/repos/DoSomething/phoenix/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/DoSomething/phoenix/downloads","issues_url":"https://api.github.com/repos/DoSomething/phoenix/issues{/number}","pulls_url":"https://api.github.com/repos/DoSomething/phoenix/pulls{/number}","milestones_url":"https://api.github.com/repos/DoSomething/phoenix/milestones{/number}","notifications_url":"https://api.github.com/repos/DoSomething/phoenix/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/DoSomething/phoenix/labels{/name}","releases_url":"https://api.github.com/repos/DoSomething/phoenix/releases{/id}","deployments_url":"https://api.github.com/repos/DoSomething/phoenix/deployments","created_at":"2013-10-15T14:50:48Z","updated_at":"2016-07-06T20:16:27Z","pushed_at":"2016-08-29T20:35:22Z","git_url":"git://github.com/DoSomething/phoenix.git","ssh_url":"git@github.com:DoSomething/phoenix.git","clone_url":"https://github.com/DoSomething/phoenix.git","svn_url":"https://github.com/DoSomething/phoenix","homepage":"http://www.dosomething.org/","size":20556,"stargazers_count":28,"watchers_count":28,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":20,"mirror_url":null,"open_issues_count":101,"forks":20,"open_issues":101,"watchers":28,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968"},"html":{"href":"https://github.com/DoSomething/phoenix/pull/6968"},"issue":{"href":"https://api.github.com/repos/DoSomething/phoenix/issues/6968"},"comments":{"href":"https://api.github.com/repos/DoSomething/phoenix/issues/6968/comments"},"review_comments":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968/comments"},"review_comment":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/DoSomething/phoenix/pulls/6968/commits"},"statuses":{"href":"https://api.github.com/repos/DoSomething/phoenix/statuses/1ee10e66fb50ad33760f74b1c01fd91473090c62"}}}}
{"actor":{"display_login":"weerd"}}