<commit_before>'use strict';

/*
   Main file which browser launches

   Catalog and Shopping Cart example app
   - Fetches catalog data from REST API
   - Renders as catalog
   - Shopping cart of selected items
   - Checkout form with validation
 */

// KJB: include needed polyfills (since this the top-level js entry point in our app)
import './util/polyfill'; // first import polyfills
import httpClient from 'axios';

function fetchData() {
  return httpClient({ url: '/fake-api.json' });
}

function fetchDataAndRender() {
  fetchData()
    .then(resp => console.log('data', resp.data))
    .catch(err => {
      console.error(err);
    });
}

fetchDataAndRender();<commit_msg>initial fetch complete, simply dumping data to console<commit_after>'use strict';

/*
   Main file which browser launches

   Catalog and Shopping Cart example app
   - Fetches catalog data from REST API
   - Renders as catalog
   - Shopping cart of selected items
   - Checkout form with validation
 */

// KJB: include needed polyfills (since this the top-level js entry point in our app)
import './util/polyfill'; // first import polyfills

// KJB: import axios (promise based http client)
import httpClient from 'axios';

function fetchData() {
  return httpClient({ url: '/fake-api.json' });
}

function fetchDataAndRender() {
  fetchData()
    .then(resp => {
      console.log("great ... our data fecth was successful!");
      console.log('data', resp.data);
    })
    .catch(err => {
      console.error(`OUCH ... an error was encountered in our fetch ... status: ${err.status}: ${err.statusText})`);
      console.error(err);
    });
}

fetchDataAndRender();
{'fraction_non_alphanumeric': 0.12106537530266344, 'fraction_numerical': 0.0, 'mean_word_length': 3.3046875, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5783036', 'n_tokens_mistral': 490, 'n_tokens_neox': 474, 'n_words': 168}