import { Divider } from "antd"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; import { useAuth } from "../../contexts/authContext"; import { User, UserStatus } from "../../models/user"; const initialSite: string = 'https://' export default function CreateTeam() { const { currUser, logOut } = useAuth() const [error, setError] = useState('') const router = useRouter() useEffect(() => { (async function() { try { // if not authenticated, take user to the login if (!currUser) { console.log('not authenticated...routing from dashboard to teams home') // router.push('/teams/login') } } catch(error) { console.log(error) router.push('/teams/login') } })(); }, []) function handleSubmit(e) { e.preventDefault() if (!teamName) { setError('You must input a team name!') } if (companySite == initialSite) { // make sure to put null in database for the team } // provision a team with state of initiated } const [teamName, setTeamName] = useState('') const [companySite, setcompanySite] = useState(initialSite) return (
{/* header */}
🙌Create a Team
{ error && {error} } Team Name Everyone in your team will see this. You can always change this later. setTeamName(e.target.value)} /> Company Site optional setcompanySite(e.target.value)} /> ) }