feat: complete relative api route integration and container build
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -26,7 +26,7 @@ export const AgendaSettingsModal: React.FC<AgendaSettingsModalProps> = ({ 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<AgendaSettingsModalProps> = ({ 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!");
|
||||
};
|
||||
|
||||
@@ -13,7 +13,7 @@ export const GoogleConnectButton: React.FC<GoogleConnectButtonProps> = ({ 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<GoogleConnectButtonProps> = ({ 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);
|
||||
|
||||
@@ -22,7 +22,7 @@ export const Sidebar: React.FC<SidebarProps> = ({ 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) {
|
||||
|
||||
@@ -19,7 +19,7 @@ const enforceUppercase = <T extends object>(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 => {
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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 })
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user