mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-02-01 20:10:35 +01:00
# Description of Changes Move frontend code into `core` folder and add infrastructure for `proprietary` folder to include premium, non-OSS features
26 lines
745 B
TypeScript
26 lines
745 B
TypeScript
import axios from 'axios';
|
|
import { handleHttpError } from '@app/services/httpErrorHandler';
|
|
import { setupApiInterceptors } from '@app/services/apiClientSetup';
|
|
|
|
// Create axios instance with default config
|
|
const apiClient = axios.create({
|
|
baseURL: import.meta.env.VITE_API_BASE_URL || '/',
|
|
responseType: 'json',
|
|
});
|
|
|
|
// Setup interceptors (core does nothing, proprietary adds JWT auth)
|
|
setupApiInterceptors(apiClient);
|
|
|
|
// ---------- Install error interceptor ----------
|
|
apiClient.interceptors.response.use(
|
|
(response) => response,
|
|
async (error) => {
|
|
await handleHttpError(error); // Handle error (shows toast unless suppressed)
|
|
return Promise.reject(error);
|
|
}
|
|
);
|
|
|
|
|
|
// ---------- Exports ----------
|
|
export default apiClient;
|