import Vue from 'vue';
import Cookies from 'js-cookie';

export default new Vue({
  data() {
    return {
      token: null
    }
  },

  created()
  {
    var self = this;

    var cookie = Cookies.get('token');
    if (typeof cookie !== 'undefined')
      self.token = cookie;
  },

  watch: {
    token(newValue)
    {
      Cookies.set('token', newValue);
    }
  }
});