bolt-templates-sms-extensio.../client/src/api/client.js
2026-03-26 19:15:08 +05:30

22 lines
602 B
JavaScript

import axios from 'axios';
import { getRuntimeApplicationId, getRuntimeCompanyId } from '../utils/runtimeContext';
const apiClient = axios.create({
baseURL: '/',
headers: { 'Content-Type': 'application/json' },
});
apiClient.interceptors.request.use((config) => {
const companyId = getRuntimeCompanyId();
const applicationId = getRuntimeApplicationId();
const headers = config.headers || {};
if (companyId) headers['x-company-id'] = companyId;
if (applicationId) headers['x-application-id'] = applicationId;
config.headers = headers;
return config;
});
export default apiClient;