<commit_before>import axios from 'axios'

let defaultData = {
  uid: '',
  token: '',
  timestamp: ''
}

export function setToken(data) {
  defaultData = {
    ...defaultData,
    ...data
  }
}

// let baseUrl = 'http://localhost:3002'
let baseUrl = 'https://2life.api.ursb.me'

axios.defaults.timeout = 20000

export default class HttpUtils {

  static get(url, data = {}) {
    url = baseUrl + url
    data = {
      ...defaultData,
      ...data
    }
    return axios.get(url, {params: data}).then(response => response.data)
  }

  static post(url, data, config) {
    url = baseUrl + url

    data = {
      ...defaultData,
      ...data
    }
    return axios.post(url, data, {
      timeout: 3500,
      ...config
    })
      .then(response => response.data)
      .catch(error => console.dir(error))<commit_msg>fix: add query to post<commit_after>import axios from 'axios'

let defaultData = {
  uid: '',
  token: '',
  timestamp: ''
}

export function setToken(data) {
  defaultData = {
    ...defaultData,
    ...data
  }
}

// let baseUrl = 'http://localhost:3002'
let baseUrl = 'https://2life.api.ursb.me'

axios.defaults.timeout = 20000

export default class HttpUtils {

  static get(url, data = {}) {
    url = baseUrl + url
    data = {
      ...defaultData,
      ...data
    }
    return axios.get(url, {params: data}).then(response => response.data)
  }

  static post(url, data, config) {
    const query = `?uid=${defaultData.uid}&timestamp=${defaultData.timestamp}&token=${defaultData.token}`
    url = baseUrl + url + query

    data = {
      ...defaultData,
      ...data
    }
    return axios.post(url, data, {
      timeout: 3500,
      ...config
    })
      .then(response => response.data)
      .catch(error => console.dir(error))
{'fraction_non_alphanumeric': 0.16165626772546796, 'fraction_numerical': 0.01588201928530913, 'mean_word_length': 2.3793103448275863, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, 'https://': 2, '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': '5737266', 'n_tokens_mistral': 610, 'n_tokens_neox': 588, 'n_words': 129}