File size: 1,391 Bytes
c0dc9e8
 
 
85c40f0
 
 
 
c0dc9e8
 
 
 
 
 
 
 
 
 
85c40f0
 
 
 
 
 
 
 
 
c0dc9e8
 
 
 
 
 
 
85c40f0
 
c0dc9e8
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import { Route, Routes } from "react-router-dom";
import { NavBar } from "./NavBar";
import { Prescripcion } from "./Prescripcion";
import { Catalogo } from "./Catalogo";
import { useEffect, useState } from "react";
import { Carrito } from "./Carrito";
import { obtenerGet } from "./lib/conexionApi";

const Home = () => {
  return <div>Home</div>;
};

const Pedidos = () => {
  return <div>Pedidos</div>;
};

export default function App() {

  const [carrito, setCarrito] = useState([])
  const [monturas, setMonturas] = useState([]);
  const [errorConsultaMonturas, setsetErrorConsultaMonturas] = useState(false);
  const [precioTotal, setPrecioTotal] = useState(0)
  useEffect(() => {
    obtenerGet("monturas", setMonturas, setsetErrorConsultaMonturas);
  }, []);

  return (
    <div className="flex flex-col items-center h-screen">
      <NavBar />
      <Routes>
        <Route path="/" element={<Home />} />
        <Route path="/pedidos" element={<Pedidos />} />
        <Route path="/prescripcion" element={<Prescripcion />} />
        <Route path="/catalogo" element={<Catalogo setCarrito={setCarrito} carrito={carrito} monturas={monturas} setMonturas={setMonturas}/>} />
        <Route path="/carrito" element={<Carrito setCarrito={setCarrito} carrito={carrito}/>} monturas={monturas} precioTotal={precioTotal} setPrecioTotal={setPrecioTotal}/>
      </Routes>
    </div>
  );
}