<commit_before>import Vue from 'vue'
import Buefy from 'buefy'
import Toasted from 'vue-toasted'
import VueProgressiveImage from 'vue-progressive-image'
import VueResize from 'vue-resize'
import FBSignInButton from 'vue-facebook-signin-button'
import App from '@/App'
import router from '@/router'
import store, { LOGIN } from '@/store'

import 'babel-polyfill'
import 'whatwg-fetch'

import 'buefy/lib/buefy.css'
import '../static/assets/facebook'

Vue.use(Buefy)
Vue.use(Toasted)
Vue.use(VueProgressiveImage)
Vue.use(VueResize)
Vue.use(FBSignInButton)

// eslint-disable-next-line no-new
new Vue({
  el: '#app',
  created: function() {
    window.fbAsyncInit = function() {
      // eslint-disable-next-line
      FB.init({
        appId: '2034722683480772',
        autoLogAppEvents: true,
        xfbml: true,
        version: 'v2.10',
        status: 'true',
      })
      // eslint-disable-next-line
      FB.AppEvents.logPageView()
      // eslint-disable-next-line
      FB.getLoginStatus(function(response) {
        if (response.status === 'connected') {
          // eslint-disable-next-line
          FB.api('/me', function(response) {
            store.dispatch(LOGIN, {
              facebookId: response.id,
              name: response.name,
            })
            fetch('/users', {
              method: 'POST',
              headers: {
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({
                facebookId: response.id,
                name: response.name,
              }),
            })
          })
        } else {
          store.dispatch(LOGIN, { facebookId: 0, name: '' })
        }
      })
    }
  },
  router,
  store,
  template: '<App/>',
  components: { App },
})<commit_msg>Fix "facebookId is undefined" error on first login<commit_after>import Vue from 'vue'
import Buefy from 'buefy'
import Toasted from 'vue-toasted'
import VueProgressiveImage from 'vue-progressive-image'
import VueResize from 'vue-resize'
import FBSignInButton from 'vue-facebook-signin-button'
import App from '@/App'
import router from '@/router'
import store, { LOGIN } from '@/store'

import 'babel-polyfill'
import 'whatwg-fetch'

import 'buefy/lib/buefy.css'
import '../static/assets/facebook'

Vue.use(Buefy)
Vue.use(Toasted)
Vue.use(VueProgressiveImage)
Vue.use(VueResize)
Vue.use(FBSignInButton)

// eslint-disable-next-line no-new
new Vue({
  el: '#app',
  created: function() {
    window.fbAsyncInit = function() {
      /* global FB */
      FB.init({
        appId: '2034722683480772',
        autoLogAppEvents: true,
        xfbml: true,
        version: 'v2.10',
        status: 'true',
      })
      FB.AppEvents.logPageView()
      FB.getLoginStatus(function(response) {
        console.log(response)
        if (response.status === 'connected' && response.authResponse != null) {
          FB.api('/me', function(dude) {
            fetch('/users', {
              method: 'POST',
              headers: {
                'Content-Type': 'application/json',
              },
              body: JSON.stringify({
                facebookId: dude.id,
                name: dude.name,
              }),
            }).then(() =>
              store.dispatch(LOGIN, {
                facebookId: dude.id,
                name: dude.name,
              })
            )
          })
        } else {
          store.dispatch(LOGIN, { facebookId: 0, name: '' })
        }
      })
    }
  },
  router,
  store,
  template: '<App/>',
  components: { App },
})
{'fraction_non_alphanumeric': 0.13906911142454162, 'fraction_numerical': 0.011283497884344146, 'mean_word_length': 2.0153061224489797, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, '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': '711117', 'n_tokens_mistral': 1163, 'n_tokens_neox': 1117, 'n_words': 229}