<commit_before>/**
 * Created by mgab on 05/05/2017.
 */

const PARTNER_ID = process.env.REACT_APP_PARTNER_ID
const SERVER = process.env.REACT_APP_SERVER

export const login = (credentials) => {
  const LOTTOLAND_API_ENDPOINT = `${SERVER}/api/client/v1/players/login`
  const body = {
    grant_type: 'password',
    username: credentials.username,
    password: <PASSWORD>,
    client_id: PARTNER_ID
  }

  return fetch(LOTTOLAND_API_ENDPOINT, {
      method: 'POST',
      headers: {
        'Content-Type': 'application/x-www-form-urlencoded',
        'Accept': 'application/json',
        'X-API-KEY': PARTNER_ID
      },
      body: body
    }
  ).then(response => {
    console.log('>>> response: ', response)
    return response.json()<commit_msg>Fixed API fetching func.<commit_after>/**
 * Created by mgab on 05/05/2017.
 */

const PARTNER_ID = process.env.REACT_APP_PARTNER_ID
const SERVER = process.env.REACT_APP_SERVER

export const login = (credentials) => {
  const LOTTOLAND_API_ENDPOINT = `${SERVER}/api/client/v1/players/login`
  const body = {
    username: credentials.username,
    password: <PASSWORD>,
    client_id: PARTNER_ID,
    grant_type: 'password'
  }

  return fetch(LOTTOLAND_API_ENDPOINT, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'accept': 'application/json',
      'x-api-key': PARTNER_ID
    },
    body: JSON.stringify(body)
  }).then(response => {
    return response.json()
{'fraction_non_alphanumeric': 0.13814432989690723, 'fraction_numerical': 0.012371134020618556, 'mean_word_length': 3.2949852507374633, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 1, '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': '3547454', 'n_tokens_mistral': 509, 'n_tokens_neox': 494, 'n_words': 95}