mirror of
https://github.com/ferdzo/iotDashboard.git
synced 2026-04-05 01:06:24 +00:00
23 lines
531 B
TypeScript
23 lines
531 B
TypeScript
import axios from 'axios';
|
|
|
|
// Use Vite proxy in development, or env variable in production
|
|
const API_BASE_URL = import.meta.env.VITE_API_URL || '/api';
|
|
|
|
export const apiClient = axios.create({
|
|
baseURL: API_BASE_URL,
|
|
headers: {
|
|
'Content-Type': 'application/json',
|
|
},
|
|
});
|
|
|
|
// Add response interceptor for error handling
|
|
apiClient.interceptors.response.use(
|
|
(response) => response,
|
|
(error) => {
|
|
// Basic error handling - can be extended if needed
|
|
return Promise.reject(error);
|
|
}
|
|
);
|
|
|
|
export default apiClient;
|