{"size": 343, "ext": "js", "max_stars_repo_path": "frontend/services/api.js", "max_stars_repo_name": "linea-it/pz-server", "max_stars_repo_stars_event_min_datetime": "2021-09-21T21:00:51.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-24T19:36:39.000Z", "max_issues_repo_path": "frontend/services/api.js", "max_issues_repo_name": "linea-it/pz-server", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "frontend/services/api.js", "max_forks_repo_name": "linea-it/pz-server", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 3, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 18.0526315789, "max_line_length": 58, "alphanum_fraction": 0.667638484}
import axios from 'axios'
import { parseCookies } from 'nookies'

export function getAPIClient(ctx) {
  const { 'pzserver.token': token } = parseCookies(ctx)

  const api = axios.create({
    baseURL: '/api'
  })

  if (token) {
    api.defaults.headers.Authorization = `Bearer ${token}`
  }

  return api
}

export const api = getAPIClient()
