p5.js-web-editor/client/utils/apiClient.js
Andrew Nicolaou a225d28f75 Use apiClient instance instead of directly calling Axios
Reduces the amount of duplication and provides a single place where
we can configure base URL, crendentials and other headers
2020-06-08 12:31:30 +02:00

17 lines
326 B
JavaScript

import axios from 'axios';
import getConfig from './getConfig';
const ROOT_URL = getConfig('API_URL');
/**
* Configures an Axios instance with the correct API URL
*/
function createClientInstance() {
return axios.create({
baseURL: ROOT_URL,
withCredentials: true
});
}
export default createClientInstance();