feat(frontend): Anpassung der Vite-Konfiguration und Verbesserung der API-Basis-URL
- Hinzufügen von Umgebungsvariablen zur Vite-Konfiguration für die Produktionsumgebung. - Anpassung der API-Basis-URL in axios.js, um sicherzustellen, dass immer der Apache-Proxy für die Produktion verwendet wird.
This commit is contained in:
@@ -1,24 +1,18 @@
|
||||
import axios from 'axios';
|
||||
import store from '../store';
|
||||
|
||||
// API-Basis-URL basierend auf der Umgebung
|
||||
// API-Basis-URL - immer über Apache-Proxy für Produktion
|
||||
const getApiBaseURL = () => {
|
||||
// Wenn explizite Umgebungsvariable gesetzt ist, diese verwenden
|
||||
if (import.meta.env.VITE_API_BASE_URL) {
|
||||
return import.meta.env.VITE_API_BASE_URL;
|
||||
}
|
||||
|
||||
// In Entwicklung: direkte Backend-Verbindung
|
||||
if (import.meta.env.DEV) {
|
||||
return 'http://localhost:3001';
|
||||
}
|
||||
|
||||
// In Produktion: über Apache-Proxy
|
||||
// Für Produktion: immer über Apache-Proxy
|
||||
return '/api';
|
||||
};
|
||||
|
||||
// Debug-Informationen
|
||||
console.log('🌍 Environment:', import.meta.env.MODE);
|
||||
console.log('🔗 API Base URL:', getApiBaseURL());
|
||||
|
||||
const apiClient = axios.create({
|
||||
|
||||
Reference in New Issue
Block a user