{"action":"created","issue":{"url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways/issues/117","repository_url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways","labels_url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways/issues/117/labels{/name}","comments_url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways/issues/117/comments","events_url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways/issues/117/events","html_url":"https://github.com/tom-and-the-toothfairies/pathways/pull/117","id":213495186,"number":117,"title":"Request chain refactor","user":{"login":"22a","id":7144173,"avatar_url":"https://avatars3.githubusercontent.com/u/7144173?v=3","gravatar_id":"","url":"https://api.github.com/users/22a","html_url":"https://github.com/22a","followers_url":"https://api.github.com/users/22a/followers","following_url":"https://api.github.com/users/22a/following{/other_user}","gists_url":"https://api.github.com/users/22a/gists{/gist_id}","starred_url":"https://api.github.com/users/22a/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/22a/subscriptions","organizations_url":"https://api.github.com/users/22a/orgs","repos_url":"https://api.github.com/users/22a/repos","events_url":"https://api.github.com/users/22a/events{/privacy}","received_events_url":"https://api.github.com/users/22a/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2017-03-11T01:45:49Z","updated_at":"2017-03-11T08:37:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways/pulls/117","html_url":"https://github.com/tom-and-the-toothfairies/pathways/pull/117","diff_url":"https://github.com/tom-and-the-toothfairies/pathways/pull/117.diff","patch_url":"https://github.com/tom-and-the-toothfairies/pathways/pull/117.patch"},"body":"\"refactor\"\r\n\r\nper https://github.com/tom-and-the-toothfairies/pathways/issues/109, split the chained requests into individual response handlers, should make it easier to reason about UI logic"},"comment":{"url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways/issues/comments/285853011","html_url":"https://github.com/tom-and-the-toothfairies/pathways/pull/117#issuecomment-285853011","issue_url":"https://api.github.com/repos/tom-and-the-toothfairies/pathways/issues/117","id":285853011,"user":{"login":"c-brenn","id":8920322,"avatar_url":"https://avatars3.githubusercontent.com/u/8920322?v=3","gravatar_id":"","url":"https://api.github.com/users/c-brenn","html_url":"https://github.com/c-brenn","followers_url":"https://api.github.com/users/c-brenn/followers","following_url":"https://api.github.com/users/c-brenn/following{/other_user}","gists_url":"https://api.github.com/users/c-brenn/gists{/gist_id}","starred_url":"https://api.github.com/users/c-brenn/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/c-brenn/subscriptions","organizations_url":"https://api.github.com/users/c-brenn/orgs","repos_url":"https://api.github.com/users/c-brenn/repos","events_url":"https://api.github.com/users/c-brenn/events{/privacy}","received_events_url":"https://api.github.com/users/c-brenn/received_events","type":"User","site_admin":false},"created_at":"2017-03-11T08:37:48Z","updated_at":"2017-03-11T08:37:48Z","body":"this is much nicer 🥇 \r\n\r\nLooking at all the `handle_` functions, I notice they have the same structure:\r\n\r\n```javascript\r\nif (response.ok) {\r\n  ...\r\n} else {\r\n  ...\r\n  displayError(...)\r\n}\r\n```\r\n\r\nDo you think it's be worth breaking out a more generic higher-order function?\r\n\r\n```javascript\r\nhandleResponse = (response, callback) => {\r\n  if (response.ok) {\r\n    const data = await ...;\r\n    callback(data);\r\n  } else {\r\n     const {error} = await ...;\r\n     displayError(error);\r\n  }\r\n};\r\n```"}}
{"actor":{"display_login":"c-brenn"}}