<commit_before>$.ajaxSetup({xhrFields: { withCredentials: true } });
$.get('https://rhinocards.herokuapp.com/isLoggedIn')
  .then(function(isLoggedIn) {
    if (!isLoggedIn) {
      window.location.href = 'https://flashrhino.com';
    }
  })
  .catch(function(error) {
    console.log(error);
  })

$(function() {
  var myEmail = decodeURIComponent(window.location.search).split("=")[1];
  console.log(myEmail);
  var cardCount = 1;
  appendSubject()
  $('.showDeckClass').on('click', function() {
      window.location = `/showDecks.html?email=${myEmail}`
  });
  $('.showStudyClass').on('click', function() {
      window.location = `/study.html?email=${myEmail}`
  });
  $('.showPlayClass').on('click', function() {
      window.location = `/play.html?email=${myEmail}`
  });
  $('.showDashboardClass').on('click', function() {
      window.location = `/dashboard.html?email=${myEmail}`
  });
  $('.Trivia').on('click', function() {
      window.location = `/trivia.html?email=${myEmail}`
  });

  $('.addCard').on('click', function(event) {
    event.preventDefault();
    ++cardCount;
    $('.card-section').append(`
      <div class="input-field col s6">
          <input id="Question-${cardCount}" type="text" class="validate">
          <label>Question</label>
      </div>
      <div class="input-field col s6">
          <input id="Answer-${cardCount}" type="text" class="validate">
          <label>Answer</label>
      </div>
      `)
  })

  $('.submit-deck').on('click', function(event) {
    var deckObject = {};
    event.preventDefault();
    deckObject.name = $('#NameOfDeck').val();
    deckObject.email = myEmail;
    deckObject.subject = $('#Subject option:selected').val();
    console.log(deckObject);
    $.post('localhost:3000', deckObject)
      .then(function(data, status) {
        console.log(data);
      })
      .catch(function(error) {
        console.log('ERRORRR',error);
      })
    var createCards = [];
    var deckName = deckObject.name;
    for (let i = 0; i < cardCount; i++) {
      var cardFront = $('#Question-' + (i + 1)).val();
      var cardBack = $('#Answer-' + (i + 1)).val();
      var cardObject = {front: cardFront, back: cardBack, name: deckName};
      console.log('card Object:',cardObject);
      createCards.push($.post('https://rhinocards.herokuapp.com/flashcard', cardObject))
    }
    Promise.all(createCards)
    .then(() => {
      window.location.href = 'https://flashrhino.com/dashboard.html?email=' + myEmail;<commit_msg>Switched deck post route back to heroku<commit_after>$.ajaxSetup({xhrFields: { withCredentials: true } });
$.get('https://rhinocards.herokuapp.com/isLoggedIn')
  .then(function(isLoggedIn) {
    if (!isLoggedIn) {
      window.location.href = 'https://flashrhino.com';
    }
  })
  .catch(function(error) {
    console.log(error);
  })

$(function() {
  var myEmail = decodeURIComponent(window.location.search).split("=")[1];
  console.log(myEmail);
  var cardCount = 1;
  appendSubject()
  $('.showDeckClass').on('click', function() {
      window.location = `/showDecks.html?email=${myEmail}`
  });
  $('.showStudyClass').on('click', function() {
      window.location = `/study.html?email=${myEmail}`
  });
  $('.showPlayClass').on('click', function() {
      window.location = `/play.html?email=${myEmail}`
  });
  $('.showDashboardClass').on('click', function() {
      window.location = `/dashboard.html?email=${myEmail}`
  });
  $('.Trivia').on('click', function() {
      window.location = `/trivia.html?email=${myEmail}`
  });

  $('.addCard').on('click', function(event) {
    event.preventDefault();
    ++cardCount;
    $('.card-section').append(`
      <div class="input-field col s6">
          <input id="Question-${cardCount}" type="text" class="validate">
          <label>Question</label>
      </div>
      <div class="input-field col s6">
          <input id="Answer-${cardCount}" type="text" class="validate">
          <label>Answer</label>
      </div>
      `)
  })

  $('.submit-deck').on('click', function(event) {
    var deckObject = {};
    event.preventDefault();
    deckObject.name = $('#NameOfDeck').val();
    deckObject.email = myEmail;
    deckObject.subject = $('#Subject option:selected').val();
    console.log(deckObject);
    $.post('https://rhinocards.herokuapp.com/deck', deckObject)
      .then(function(data, status) {
        console.log(data);
      })
      .catch(function(error) {
        console.log('ERRORRR',error);
      })
    var createCards = [];
    var deckName = deckObject.name;
    for (let i = 0; i < cardCount; i++) {
      var cardFront = $('#Question-' + (i + 1)).val();
      var cardBack = $('#Answer-' + (i + 1)).val();
      var cardObject = {front: cardFront, back: cardBack, name: deckName};
      console.log('card Object:',cardObject);
      createCards.push($.post('https://rhinocards.herokuapp.com/flashcard', cardObject))
    }
    Promise.all(createCards)
    .then(() => {
      window.location.href = 'https://flashrhino.com/dashboard.html?email=' + myEmail;
{'fraction_non_alphanumeric': 0.2058882037000199, 'fraction_numerical': 0.003580664412174259, 'mean_word_length': 3.2901023890784984, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 9, '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': '3586270', 'n_tokens_mistral': 1653, 'n_tokens_neox': 1641, 'n_words': 253}