{"size": 568, "ext": "js", "max_stars_repo_path": "src/util/client.js", "max_stars_repo_name": "banked/banked-node", "max_stars_repo_stars_event_min_datetime": "2020-06-03T13:10:00.000Z", "max_stars_repo_stars_event_max_datetime": "2020-06-03T13:10:00.000Z", "max_issues_repo_path": "src/util/client.js", "max_issues_repo_name": "banked/banked-node", "max_issues_repo_issues_event_min_datetime": "2020-03-17T16:20:50.000Z", "max_issues_repo_issues_event_max_datetime": "2020-06-17T10:58:05.000Z", "max_forks_repo_path": "src/util/client.js", "max_forks_repo_name": "banked/banked-node", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": 4, "max_forks_count": null, "avg_line_length": 19.5862068966, "max_line_length": 67, "alphanum_fraction": 0.6197183099}
import axios from "axios";

let instance;

const bootstrapClient = keys => {
  instance = axios.create({
    baseURL: "https://api.banked.com/v2",
    timeout: 3000
  });
  instance.interceptors.request.use(config => {
    if (keys.access_token) {
      config.headers.Authorization = `Bearer ${keys.access_token}`;
    } else {
      config.auth = {
        username: keys.api_key,
        password: keys.secret_key
      };
    }
    return config;
  });
  return instance;
};

const getClient = () => {
  return instance;
};

export { bootstrapClient, getClient };
