fix
All checks were successful
build-and-deploy / build (push) Successful in 8s
build-and-deploy / deploy (push) Successful in 15s

This commit is contained in:
2025-09-06 17:49:57 -06:00
parent f7d1f5bb02
commit 7a5bd7f78e
3 changed files with 49 additions and 11 deletions

View File

@@ -1,6 +1,9 @@
import { useState, useEffect } from 'react'
import './App.css'
// Configure API base URL via Vite env, default to same-origin
const API_BASE = import.meta.env.VITE_API_BASE || ''
function App() {
const [nombre, setNombre] = useState('')
const [amigos, setAmigos] = useState([])
@@ -13,7 +16,7 @@ function App() {
const fetchAmigos = async () => {
try {
const response = await fetch('http://localhost:3001/api/amigos')
const response = await fetch(`${API_BASE}/api/amigos`)
const data = await response.json()
setAmigos(data)
} catch (error) {
@@ -33,7 +36,7 @@ function App() {
setMessage('')
try {
const response = await fetch('http://localhost:3001/api/amigos', {
const response = await fetch(`${API_BASE}/api/amigos`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',