You can set default configurations for Axios, which will apply to all requests:
axios.defaults.baseURL = 'https://jsonplaceholder.typicode.com';
axios.defaults.headers.common['Authorization'] = 'Bearer YOUR_TOKEN';
// Making a request with default configurations
axios.get('/posts')
.then(response => {
console.log('Data:', response.data);
});
Leave a Reply