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