<commit_before>require('insert-css')(require('./index.styl'));

var Vue   = require('vue'),
    User  = require('../user')
;

module.exports = Vue.extend({
  template: require('./index.html'),
  data: {
    categories: [],
    category: ''
  },
  created: function() {
    if (!User.current()) {
      this.$parent.view = 'login';
      return;
    }
    User.fetchCategories().done(function(categories) {
      this.categories = categories.map(function(category) { return category.attributes });
    }.bind(this));
  },
  methods: {
    addCategory: function() {
      if (!this.category) return;
      User.addCategory(this.category).done(function() {
        console.log(this);
        this.categories.push(this.category);
      }.bind(this));
    }
  }
});
<commit_msg>Reflect added category<commit_after>require('insert-css')(require('./index.styl'));

var Vue   = require('vue'),
    User  = require('../user')
;

module.exports = Vue.extend({
  template: require('./index.html'),
  data: {
    categories: [],
    category: ''
  },
  created: function() {
    if (!User.current()) {
      this.$parent.view = 'login';
      return;
    }
    User.fetchCategories().done(function(categories) {
      this.categories = categories.map(function(category) { return category.attributes });
    }.bind(this));
  },
  methods: {
    addCategory: function() {
      if (!this.category) return;
      User.addCategory(this.category).done(function(category) {
        this.categories.push(category.attributes);
      }.bind(this));
    }
  }
});

{'fraction_non_alphanumeric': 0.1867704280155642, 'fraction_numerical': 0.0, 'mean_word_length': 3.0077922077922077, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '2047720', 'n_tokens_mistral': 478, 'n_tokens_neox': 471, 'n_words': 73}