Skip to content

Instantly share code, notes, and snippets.

@Nilanth

Nilanth/.jsx Secret

Last active July 10, 2021 07:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Nilanth/3d6fd06f4f66e63d2877f90ff9b15e19 to your computer and use it in GitHub Desktop.
Save Nilanth/3d6fd06f4f66e63d2877f90ff9b15e19 to your computer and use it in GitHub Desktop.
axios client
import axios from 'axios';
const axiosClient = axios.create();
axiosClient.defaults.baseURL = 'https://example.com/api/v1';
axiosClient.defaults.headers = {
'Content-Type': 'application/json',
Accept: 'application/json'
};
//All request will wait 2 seconds before timeout
axiosClient.defaults.timeout = 2000;
axiosClient.defaults.withCredentials = true;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment