{"action":"created","issue":{"url":"https://api.github.com/repos/unicef/etools-tpm/issues/25","repository_url":"https://api.github.com/repos/unicef/etools-tpm","labels_url":"https://api.github.com/repos/unicef/etools-tpm/issues/25/labels{/name}","comments_url":"https://api.github.com/repos/unicef/etools-tpm/issues/25/comments","events_url":"https://api.github.com/repos/unicef/etools-tpm/issues/25/events","html_url":"https://github.com/unicef/etools-tpm/pull/25","id":366996399,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIwNTM3ODgy","number":25,"title":"Async/await for api calls","user":{"login":"marko911","id":15694731,"node_id":"MDQ6VXNlcjE1Njk0NzMx","avatar_url":"https://avatars3.githubusercontent.com/u/15694731?v=4","gravatar_id":"","url":"https://api.github.com/users/marko911","html_url":"https://github.com/marko911","followers_url":"https://api.github.com/users/marko911/followers","following_url":"https://api.github.com/users/marko911/following{/other_user}","gists_url":"https://api.github.com/users/marko911/gists{/gist_id}","starred_url":"https://api.github.com/users/marko911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marko911/subscriptions","organizations_url":"https://api.github.com/users/marko911/orgs","repos_url":"https://api.github.com/users/marko911/repos","events_url":"https://api.github.com/users/marko911/events{/privacy}","received_events_url":"https://api.github.com/users/marko911/received_events","type":"User","site_admin":false},"labels":[{"id":1079868198,"node_id":"MDU6TGFiZWwxMDc5ODY4MTk4","url":"https://api.github.com/repos/unicef/etools-tpm/labels/WIP","name":"WIP","color":"fceb7e","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-10-04T22:38:39Z","updated_at":"2018-10-11T14:54:29Z","closed_at":"2018-10-11T14:54:29Z","author_association":"CONTRIBUTOR","pull_request":{"url":"https://api.github.com/repos/unicef/etools-tpm/pulls/25","html_url":"https://github.com/unicef/etools-tpm/pull/25","diff_url":"https://github.com/unicef/etools-tpm/pull/25.diff","patch_url":"https://github.com/unicef/etools-tpm/pull/25.patch"},"body":"In order to move away from using etools-ajax and having to put 10 elements like this: \r\n```\r\n<etools-ajax-sp\r\n                id=\"tpmPartners\"\r\n                url=\"[[partnersUrl]]\"\r\n                on-success=\"_partnersLoaded\"\r\n                on-fail=\"_partnersError\">\r\n        </etools-ajax-sp>\r\n\r\n        <etools-ajax-sp\r\n                method=\"OPTIONS\"\r\n                url=\"[[partnersOptionsUrl]]\"\r\n                on-success=\"_handlePartnersOptions\"\r\n                on-fail=\"_handlePartnersOptions\">\r\n        </etools-ajax-sp>\r\n\r\n        <etools-ajax-sp\r\n                method=\"OPTIONS\"\r\n                url=\"[[visitsOptionsUrl]]\"\r\n                on-success=\"_handleVisitsOptions\"\r\n                on-fail=\"_handleVisitsOptions\">\r\n        </etools-ajax-sp>\r\n\r\n        <!--partner organisations-->\r\n        <etools-ajax-sp\r\n                endpoint=\"[[organisationsEndpoint]]\"\r\n                caching-storage=\"custom\"\r\n                dexie-db-collection=\"partners\"\r\n                on-success=\"_organisationsLoaded\"\r\n                on-fail=\"_organisationsError\">\r\n        </etools-ajax-sp>\r\n\r\n        <!-- filter TP-->\r\n        <etools-ajax-sp\r\n                url=\"[[filterIPUrl]]\"\r\n                on-success=\"_filterIPLoaded\"\r\n                on-fail=\"_filterIPError\">\r\n        </etools-ajax-sp>\r\n\r\n        <!-- filter Sections-->\r\n        <etools-ajax-sp\r\n                url=\"[[filterSectionsUrl]]\"\r\n                on-success=\"_filterSectionsLoaded\"\r\n                on-fail=\"_filterSectionsError\">\r\n        </etools-ajax-sp>\r\n\r\n        <!-- filter CP Outputs-->\r\n        <etools-ajax-sp\r\n                url=\"[[filterCpOutputsUrl]]\"\r\n                on-success=\"_filterOutputsLoaded\"\r\n                on-fail=\"_filterOutputsError\">\r\n        </etools-ajax-sp>\r\n\r\n        <!--Sections Covered-->\r\n        <etools-ajax-sp\r\n                url=\"[[sectionsEndpoint]]\"\r\n                on-success=\"_sectionsLoaded\"\r\n                on-fail=\"_sectionsError\">\r\n        </etools-ajax-sp>\r\n\r\n        <!--Unicef Users-->\r\n        <etools-ajax-sp\r\n                url=\"[[unicefUsersEndpoint]]\"\r\n                on-success=\"_unicefUsersLoaded\"\r\n                on-fail=\"_unicefUsersError\">\r\n        </etools-ajax-sp>\r\n```\r\n\r\nI suggest we just use `babel-preset-env` and then a `Promise.all([...async functions])`.\r\nI do know that it is probably not your concern anymore for this module but this pattern can be useful for future modules you work on. \r\nWe can use properties in polymer to configure each endpoint options ie method, body etc.\r\nLet me know your thoughts @v-urbanovich \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/unicef/etools-tpm/issues/comments/428986489","html_url":"https://github.com/unicef/etools-tpm/pull/25#issuecomment-428986489","issue_url":"https://api.github.com/repos/unicef/etools-tpm/issues/25","id":428986489,"node_id":"MDEyOklzc3VlQ29tbWVudDQyODk4NjQ4OQ==","user":{"login":"marko911","id":15694731,"node_id":"MDQ6VXNlcjE1Njk0NzMx","avatar_url":"https://avatars3.githubusercontent.com/u/15694731?v=4","gravatar_id":"","url":"https://api.github.com/users/marko911","html_url":"https://github.com/marko911","followers_url":"https://api.github.com/users/marko911/followers","following_url":"https://api.github.com/users/marko911/following{/other_user}","gists_url":"https://api.github.com/users/marko911/gists{/gist_id}","starred_url":"https://api.github.com/users/marko911/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marko911/subscriptions","organizations_url":"https://api.github.com/users/marko911/orgs","repos_url":"https://api.github.com/users/marko911/repos","events_url":"https://api.github.com/users/marko911/events{/privacy}","received_events_url":"https://api.github.com/users/marko911/received_events","type":"User","site_admin":false},"created_at":"2018-10-11T14:54:29Z","updated_at":"2018-10-11T14:54:29Z","author_association":"CONTRIBUTOR","body":"Dont worry I will not implement this, I didn't realize etools-ajax had this done for polymer 1...its all good"}}
{"actor":{"display_login":"marko911"}}