From e2afe9a092d441d943bebfb858b1d29d9add0dae Mon Sep 17 00:00:00 2001 From: Sebastian Wyngaard Date: Thu, 6 Feb 2020 16:44:01 +0000 Subject: [PATCH] Simplify data retrieval --- js/egm.js | 18 +++++++----------- robots.txt | 2 ++ 2 files changed, 9 insertions(+), 11 deletions(-) create mode 100644 robots.txt diff --git a/js/egm.js b/js/egm.js index 97388a2..212091d 100644 --- a/js/egm.js +++ b/js/egm.js @@ -64,18 +64,14 @@ const app = new Vue({ filtered_documents: [], filter_categories: {} }, - mounted: function () { - axios - .get('https://raw.githubusercontent.com/crcresearch/usaid-pse-egm/master/data/latest.json') - .then(response => axios.get(`https://raw.githubusercontent.com/crcresearch/usaid-pse-egm/master/data/${response.data}`)) - .then(response => { - this.documents = response.data.records; - this.filtered_documents = this.documents; - this.filtered_summary = this.filter_records(); - this.filter_categories = response.data.filteredFields; - }); + mounted: async function () { + const response = await axios.get('data/latest.json', { responseType: 'json' }); + this.documents = response.data.records; + this.filtered_documents = this.documents; + this.filtered_summary = this.filter_records(); + this.filter_categories = response.data.filteredFields; }, - // define methods under the `methods` object + methods: { filter_records: function () { const new_summary = [ diff --git a/robots.txt b/robots.txt new file mode 100644 index 0000000..567f392 --- /dev/null +++ b/robots.txt @@ -0,0 +1,2 @@ +User-agent: * +Disallow: /.github/ \ No newline at end of file