import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { getExos, getTags } from "../../requests/requests.exos.js"; import { createParcours } from "../../requests/requests.room.js"; import { isBrowser } from "../../utils/utils.js"; import SelectExo from "../pdf_gen/selectExo.jsx"; export default function CreateParcours({ roomCode, user }) { const [selected, setSelected] = useState([]); const [empty, setEmpty] = useState(false); const [exosList, setExos] = useState([]); const router = useRouter(); useEffect(() => { getExos("web").then((exos) => { setExos([ ...exos.map((d) => { return { ...d, numberInExo: 10, numberOfExo: 1 }; }), ]); }); return () => { setExos([]); }; }, []); const [tags, setTags] = useState(); useEffect(() => { console.log("test"); getTags().then((tags) => { setTags([...tags]); }); return () => { setTags([]); }; }, []); const [options, setOptions] = useState({ name: "parcourd test ", timer: 10, }); return (
{exosList && tags && ( <> {" "} { setOptions({ ...options, name: e.target.value }); }} /> { setOptions({ ...options, timer: parseInt(e.target.value) }); }} /> )}
); }