fedi-feed-router/resources/js/bootstrap.ts

21 lines
611 B
TypeScript
Raw Normal View History

2025-08-02 15:28:38 +02:00
/**
* Bootstrap file for setting up global configurations
*/
// Set up axios defaults
import axios from 'axios';
axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
axios.defaults.headers.common['Accept'] = 'application/json';
axios.defaults.headers.common['Content-Type'] = 'application/json';
// Add CSRF token if available
const token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
axios.defaults.headers.common['X-CSRF-TOKEN'] = (token as HTMLMetaElement).content;
}
// Set base URL for API calls
axios.defaults.baseURL = '/api/v1';
export default axios;