<commit_before>module.exports = function(e) {

 if (this.ajax)
  e.preventDefault();

  if (this.errors.length>0) {

    this.showAllErrors();
    e.preventDefault();

    this.$dispatch('vue-formular.invalid.client', this.errors);

    return false;
  }

  if (this.pristine) {
    e.preventDefault();
    return false;
  }

  if (!this.ajax) return;

  var data = this.formData();

  this.$dispatch('vue-formular.sending', data);

  this.serverErrors = '';
  this.status = 'info';
  this.statusbarMessage = this.options.texts.sending;

  this.$http[this.method.toLowerCase()](this.action,data).then(function(data){

    this.reinitForm();
    this.$dispatch('vue-formular.sent', data);
    this.status = 'success';

    this.statusbarMessage = typeof data.data=='string'?data.data:this.options.texts.sent;

  }.bind(this))
  .catch(function(response) {

    this.$dispatch('vue-formular.invalid.server', response);
    this.status = 'danger';

    var errors = response.data;

    if (typeof errors=='string') {
       this.statusbarMessage = errors;
       return;
    }

 if (typeof errors=='object')
     errors.forEach(function(error, i) {
      errors[i].show = true;
    });
     this.statusbarMessage= '';
     this.serverErrors = errors;

}.bind(this));

}
<commit_msg>move sending event before data fetching<commit_after>module.exports = function(e) {

 if (this.ajax)
  e.preventDefault();

  if (this.errors.length>0) {

    this.showAllErrors();
    e.preventDefault();

    this.$dispatch('vue-formular.invalid.client', this.errors);

    return false;
  }

  if (this.pristine) {
    e.preventDefault();
    return false;
  }

  if (!this.ajax) return;

  this.$dispatch('vue-formular.sending', data);

  var data = this.formData();

  this.serverErrors = '';
  this.status = 'info';
  this.statusbarMessage = this.options.texts.sending;

  this.$http[this.method.toLowerCase()](this.action,data).then(function(data){

    this.reinitForm();
    this.$dispatch('vue-formular.sent', data);
    this.status = 'success';

    this.statusbarMessage = typeof data.data=='string'?data.data:this.options.texts.sent;

  }.bind(this))
  .catch(function(response) {

    this.$dispatch('vue-formular.invalid.server', response);
    this.status = 'danger';

    var errors = response.data;

    if (typeof errors=='string') {
       this.statusbarMessage = errors;
       return;
    }

 if (typeof errors=='object')
     errors.forEach(function(error, i) {
      errors[i].show = true;
    });
     this.statusbarMessage= '';
     this.serverErrors = errors;

}.bind(this));

}

{'fraction_non_alphanumeric': 0.16640866873065016, 'fraction_numerical': 0.0007739938080495357, 'mean_word_length': 3.337248322147651, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '6500184', 'n_tokens_mistral': 869, 'n_tokens_neox': 828, 'n_words': 137}