diff --git a/docker-compose.yml b/docker-compose.yml index ea65f6b..af63fcb 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -2,6 +2,8 @@ services: nginx: image: nginx:alpine restart: always + ports: + - "8020:80" volumes: - "./nginx/default.conf:/etc/nginx/conf.d/default.conf:ro" labels: diff --git a/frontend/components/AgendaSettingsModal.tsx b/frontend/components/AgendaSettingsModal.tsx index aa00b91..c87b224 100644 --- a/frontend/components/AgendaSettingsModal.tsx +++ b/frontend/components/AgendaSettingsModal.tsx @@ -26,7 +26,7 @@ export const AgendaSettingsModal: React.FC = ({ isOpen const fetchGoogleStatus = async () => { try { - const response = await fetch('http://localhost:3005/api/auth/google/status'); + const response = await fetch('/api/auth/google/status'); const data = await response.json(); setConnectedAccounts(data); } catch (error) { @@ -56,7 +56,7 @@ export const AgendaSettingsModal: React.FC = ({ isOpen }, [isOpen]); const copyInviteLink = (dentistId: string) => { - const url = `http://localhost:3005/api/auth/google/url?dentistId=${dentistId}`; + const url = `/api/auth/google/url?dentistId=${dentistId}`; navigator.clipboard.writeText(url); toast.success("LINK DE CONVITE COPIADO!"); }; diff --git a/frontend/components/GoogleConnectButton.tsx b/frontend/components/GoogleConnectButton.tsx index 77307a9..a56f53b 100644 --- a/frontend/components/GoogleConnectButton.tsx +++ b/frontend/components/GoogleConnectButton.tsx @@ -13,7 +13,7 @@ export const GoogleConnectButton: React.FC = ({ ownerI const handleConnect = async () => { setIsLoading(true); try { - const response = await fetch(`http://localhost:3005/api/auth/google/url?dentistId=${ownerId}`); + const response = await fetch(`/api/auth/google/url?dentistId=${ownerId}`); const { url } = await response.json(); // Abrir em popup para manter o contexto @@ -48,7 +48,7 @@ export const GoogleConnectButton: React.FC = ({ ownerI setIsLoading(true); try { - await fetch(`http://localhost:3005/api/auth/google/${ownerId}`, { method: 'DELETE' }); + await fetch(`/api/auth/google/${ownerId}`, { method: 'DELETE' }); if (onStatusChange) onStatusChange(); } catch (error) { console.error('Erro ao desconectar:', error); diff --git a/frontend/components/Sidebar.tsx b/frontend/components/Sidebar.tsx index 61a479b..80327fc 100644 --- a/frontend/components/Sidebar.tsx +++ b/frontend/components/Sidebar.tsx @@ -22,7 +22,7 @@ export const Sidebar: React.FC = ({ activeTab, setActiveTab }) => const fetchGoogleStatus = async () => { try { - const response = await fetch('http://localhost:3005/api/auth/google/status'); + const response = await fetch('/api/auth/google/status'); const data = await response.json(); setConnectedAccounts(data); } catch (error) { diff --git a/frontend/services/backend.ts b/frontend/services/backend.ts index e1173bb..80259ae 100644 --- a/frontend/services/backend.ts +++ b/frontend/services/backend.ts @@ -19,7 +19,7 @@ const enforceUppercase = (data: T): T => { return newData; }; -const API_URL = import.meta.env.VITE_API_URL || 'http://localhost:3005/api'; +const API_URL = import.meta.env.VITE_API_URL || '/api'; // Returns headers always including the JWT token stored after login const getAuthHeaders = (): HeadersInit => { diff --git a/frontend/views/AdminViews.tsx b/frontend/views/AdminViews.tsx index f4e1eeb..5b57734 100644 --- a/frontend/views/AdminViews.tsx +++ b/frontend/views/AdminViews.tsx @@ -107,7 +107,7 @@ export const DentistasView: React.FC = () => { const fetchGoogleStatus = async () => { try { - const response = await fetch('http://localhost:3005/api/auth/google/status'); + const response = await fetch('/api/auth/google/status'); const data = await response.json(); setConnectedAccounts(data); } catch (error) { @@ -163,7 +163,7 @@ export const DentistasView: React.FC = () => { const handleInviteDentist = async (d: Dentista) => { try { const activeW = HybridBackend.getActiveWorkspace(); - const res = await fetch('http://localhost:3005/api/dentistas/magic-link', { + const res = await fetch('/api/dentistas/magic-link', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ clinicaId: activeW.id, dentistName: d.nome }) diff --git a/frontend/views/ClinicasView.tsx b/frontend/views/ClinicasView.tsx index eadf8dd..92378e1 100644 --- a/frontend/views/ClinicasView.tsx +++ b/frontend/views/ClinicasView.tsx @@ -38,7 +38,7 @@ export const ClinicasView: React.FC = () => { const handleUpdateColor = async (workspaceId: string, color: string) => { setSavingColor(true); try { - const res = await fetch(`http://localhost:3005/api/clinicas/${workspaceId}/color`, { + const res = await fetch(`/api/clinicas/${workspaceId}/color`, { method: 'PUT', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ cor: color }) diff --git a/frontend/views/DentistRegisterView.tsx b/frontend/views/DentistRegisterView.tsx index 9e9df76..4addde4 100644 --- a/frontend/views/DentistRegisterView.tsx +++ b/frontend/views/DentistRegisterView.tsx @@ -41,7 +41,7 @@ export const DentistRegisterView: React.FC = () => { e.preventDefault(); setLoading(true); try { - const res = await fetch('http://localhost:3005/api/dentistas/register', { + const res = await fetch('/api/dentistas/register', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ diff --git a/frontend/views/MeusTratamentos.tsx b/frontend/views/MeusTratamentos.tsx index 3c4f324..a34db36 100644 --- a/frontend/views/MeusTratamentos.tsx +++ b/frontend/views/MeusTratamentos.tsx @@ -91,7 +91,7 @@ export const MeusTratamentos: React.FC = () => { sortOrder }); - const res = await fetch(`http://localhost:3002/api/guias?${params}`); + const res = await fetch(`/api/guias?${params}`); if (!res.ok) throw new Error('Falha ao carregar guias'); return res.json(); };