diff --git a/docker-compose.yml b/docker-compose.yml index c375e84..4aa11f3 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -79,8 +79,8 @@ services: - ./frontend:/app - /app/node_modules environment: - - VITE_API_URL=http://192.168.196.100:3000 - - VITE_ALPR_STREAM_URL=http://192.168.196.100:5001/video_feed + - VITE_API_URL= + - VITE_ALPR_STREAM_URL= networks: backend-net: driver: bridge diff --git a/frontend/src/pages/AdminDashboard.jsx b/frontend/src/pages/AdminDashboard.jsx index 895afa7..8f9bfbd 100644 --- a/frontend/src/pages/AdminDashboard.jsx +++ b/frontend/src/pages/AdminDashboard.jsx @@ -5,7 +5,7 @@ import { Users, CheckCircle, XCircle, Shield, Trash2, Camera, AlertCircle } from import { useTranslation } from 'react-i18next'; import LanguageSelector from '../components/LanguageSelector'; -const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000'; +const API_URL = import.meta.env.VITE_API_URL || ''; const socket = io(API_URL); function AdminDashboard({ token }) { @@ -268,7 +268,7 @@ function AdminDashboard({ token }) {
e.target.style.display = 'none'} /> diff --git a/frontend/src/pages/Login.jsx b/frontend/src/pages/Login.jsx index dde262e..05a98f3 100644 --- a/frontend/src/pages/Login.jsx +++ b/frontend/src/pages/Login.jsx @@ -4,7 +4,7 @@ import { Lock, User } from 'lucide-react'; import { useTranslation } from 'react-i18next'; import LanguageSelector from '../components/LanguageSelector'; -const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000'; +const API_URL = import.meta.env.VITE_API_URL || ''; function Login({ setToken, setUserRole, setUsername }) { const { t } = useTranslation(); diff --git a/frontend/src/pages/UserDashboard.jsx b/frontend/src/pages/UserDashboard.jsx index 5459637..3e89899 100644 --- a/frontend/src/pages/UserDashboard.jsx +++ b/frontend/src/pages/UserDashboard.jsx @@ -5,7 +5,7 @@ import io from 'socket.io-client'; import { useTranslation } from 'react-i18next'; import LanguageSelector from '../components/LanguageSelector'; -const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3000'; +const API_URL = import.meta.env.VITE_API_URL || ''; const socket = io(API_URL); function UserDashboard({ token, username }) { @@ -247,7 +247,7 @@ function UserDashboard({ token, username }) {
{p.status === 'APPROVED' ? t('approved') : p.status === 'DENIED' ? t('denied') : t('pending')} diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 4484e4a..b6f06cb 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -5,6 +5,20 @@ import react from '@vitejs/plugin-react' export default defineConfig({ plugins: [react()], server: { - allowedHosts: ['demo.v1ru5.cl'] + allowedHosts: ['demo.v1ru5.cl'], + proxy: { + '/api': { + target: 'http://backend:3000', + changeOrigin: true + }, + '/socket.io': { + target: 'http://backend:3000', + ws: true + }, + '/video_feed': { + target: 'http://alpr-service:5001', + changeOrigin: true + } + } } })