"use client"; import { envConfig } from "@/app/lib/config"; import axios from "axios"; import { useEffect, useState } from "react"; interface Area { id_area_ubicacion: number; area: string; extra: string; } interface Props { onSearch: (id: number) => void; } export default function SelectorSala({ onSearch }: Props) { const [sala, setSala] = useState(); const [selected, setSelected] = useState(); const handleChangeEquipo = (e: React.ChangeEvent) => { setSelected(Number(e.target.value)); }; const handleSubmit = (e: React.FormEvent) => { e.preventDefault(); if (!selected) return; onSearch(selected); }; useEffect(() => { const fetchData = async () => { const response = await axios.get(`${envConfig.apiUrl}/area-ubicacion`); setSala(response.data); }; fetchData(); }, []); return (
); }