import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { createRoom } from "../../requests/requests.room.js"; import styles from "../../styles/room/create.module.scss"; import { isBrowser, parseClassName } from "../../utils/utils.js"; import Layout from "../Layout.js"; import Input from "../Input.jsx"; import { useSessionContext } from "../../context/session.context.js"; import { isEmpty } from "rxjs"; export default function Create() { const [infos, setInfos] = useState({ name: "", nick: "", private: true, results: false, }); const { authData} = useSessionContext(); useEffect(() => { if (isBrowser && localStorage.getItem('token') !== null) { if (authData) { setInfos({ ...infos, nick: authData.username }); } } }, [isBrowser && localStorage.getItem('token') !== null]); const [pseudoMode, setPseudoMode] = useState(false); const [fade, setFade] = useState(false) useEffect(() => { setTimeout(() => { setPseudoMode(fade) }, 300) }, [fade]) const router = useRouter(); return (
{!pseudoMode && (

Nouvelle salle

{ setInfos({ ...infos, name: e.target.value }); }} />
{ setInfos({ ...infos, private: !infos.private }); }} type="checkbox" name="" id="private" />
{ setInfos({ ...infos, results: !infos.results }); }} type="checkbox" name="" id="results" />
)} {pseudoMode && (

Entrez votre pseudo

{ if (isEmpty(authData)) { setInfos({ ...infos, nick: e.target.value }); } }} />
)}
); }