diff --git a/App.tsx b/App.tsx index e0ae8fc..75d1eac 100644 --- a/App.tsx +++ b/App.tsx @@ -50,9 +50,9 @@ export default function App() { let [showBack, setShowBack] = useState(''); const [movies, setMovies] = useState([]); const [shows, setShows] = useState([]); - const [selCat, setSelCat] = useState({}); + const [selCat, setSelCat] = useState({id:0}); const [otherCategories, setOtherCategories] = useState([]); - const [other, setOther] = useState([]); + const [others, setOthers] = useState([]); @@ -81,6 +81,16 @@ export default function App() { } fetchData() }, []); + + useEffect(() => { + const fetchData = async () => { + const other = await db.from('others').select().eq({category: selCat.id}); + if (other.data) { + setOthers(other.data); + } + } + fetchData() + }, [selCat]); const changeTheme = async (mode:string ) => { switch(mode) { @@ -122,19 +132,19 @@ export default function App() { setMovies([]); setShows([]); setOtherCategories([]); - setOther([]); + setOthers([]); } return ( - + }/> } /> }/> - } /> - } /> + } /> + } /> } />