import { useState } from 'react'; import axios from 'axios'; import MovieCard from './MovieCard.jsx'; import Input from '../components/input/Input.jsx'; // Замените на фактический путь import { Button } from 'react-bootstrap'; const useMovieFilter = () => { const [searchText, setSearchText] = useState(''); const [searchResult, setSearchResult] = useState([]); const handleSearchChange = (e) => { setSearchText(e.target.value); }; const handleSearch = async () => { try { const response = await axios.get(`http://localhost:8081/lines?name_like=${searchText}`); setSearchResult(response.data); } catch (error) { console.error('Error fetching movies:', error); } }; const handleKeyPress = (e) => { if (e.key === 'Enter') { handleSearch(); } }; return ( <>
{searchResult.map((movie) => ( ))}
); }; export default useMovieFilter;