title: Handle login API token in Vue JS
body: <p>I am using following Login component:</p>
  
  <pre><code>var Login = Vue.extend({
      template: '#auth',
      data: function () {
          return {username: '',password: '',errorMessage:''};
      },
      methods : {
          login: function (e) {
              var _this = this;
              $.ajax({
                  url: "/vue/api/login",
                  type: "POST",
                  async:false,
                  data:{
                      username:_this.username,
                      password: _this.password
                  },
                  success: function (data) {
                  // store the token in global variable ??
                      router.push({
                          path: '/employeeList',
                      });
                  },
                  error:function (xhr, status, error) {
  
                      _this.errorMessage = xhr.responseText
                  }
              });
          }
      }
  });
  </code></pre>
  
  <p>The login API returns a token string for successful authentication. Should I store it in global variable or local storage ? Is there any filter that I can use to check if the user is logged in to application and then redirect accordingly?</p>