delete hardCode
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
function Equipos() {
|
||||
@@ -9,7 +10,7 @@ function Equipos() {
|
||||
const [mensaje, setMensaje] = useState("");
|
||||
|
||||
useEffect(() => {
|
||||
fetch("http://localhost:5000/equipo")
|
||||
fetch(`${envConfig.apiUrl}/equipo`)
|
||||
.then((res) => res.json())
|
||||
.then((data) => setEquipos(data))
|
||||
.catch(() => setMensaje("Error al cargar equipos"));
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import axios from "axios";
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
|
||||
interface Mesa {
|
||||
idMesa: number;
|
||||
@@ -18,7 +19,7 @@ export default function MesasDisponibles() {
|
||||
|
||||
const obtenerMesas = async () => {
|
||||
try {
|
||||
const response = await axios.get("http://localhost:5000/mesa");
|
||||
const response = await axios.get(`${envConfig.apiUrl}/mesa`);
|
||||
setMesas(response.data);
|
||||
} catch (error) {
|
||||
console.error("Error al obtener mesas:", error);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
"use client";
|
||||
|
||||
import { envConfig } from "@/app/lib/config";
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
export default function TableEquipos() {
|
||||
@@ -8,8 +9,7 @@ export default function TableEquipos() {
|
||||
|
||||
useEffect(() => {
|
||||
console.log("LLAMANDO API EQUIPO");
|
||||
|
||||
fetch("http://localhost:5000/equipo")
|
||||
fetch(`${envConfig.apiUrl}/equipo`)
|
||||
.then((res) => res.json())
|
||||
.then((data) => {
|
||||
console.log("EQUIPOS:", data);
|
||||
|
||||
Reference in New Issue
Block a user