var axios = require('axios');
var config = {
  headers:{'Cookie':'token=YWRtaW46YWRtaW5wYXNz'}
}

module.exports = {

  checkUser: function(username, password) {
    return axios.get('http://localhost:9080/DAAExample/login?login='+ username + '&password=' + password)
    .then(function (response) {
      if (response.status === 204) {
        return true;
      } else {
        return false;
      }
    })
  },

  fetchUsers: function () {
    return axios.get('http://localhost:9080/DAAExample/rest/people')
      .then(function (response) {
        return response.data.items;
      });
  }

};