// https://management.beanstalkedu.com/items/school // import React from 'react'; import { useId,useState, useEffect,useMemo } from 'react'; import Select from 'react-select' import countryList from 'react-select-country-list' import 'react-phone-number-input/style.css' import PhoneInput from 'react-phone-number-input' import NavBar from '../components/NavBar'; // import { Inter } from 'next/font/google' export default function addUserForm (){ const [countryValue, setCountryValue] = useState('') const options = useMemo(() => countryList().getData(), []) const [phoneValue, setphoneValue] = useState() let [individualValue=true, setindividualValue] = useState() // console.log(phoneValue) const selectCountry = countryValue => { setCountryValue(countryValue) } const individual = (event) => { // console.log(event.target.schoolID.value) setindividualValue(individualValue=false) } const [school, setSchool] = useState(null); useEffect(() => { fetch(`https://management.beanstalkedu.com/items/school`). then(res => res.json()) .then(data => { setSchool(data) }) }, []) // console.log(school); const handleFormsubmit = async (event) => { event.preventDefault() const data = { "status":"published", type: event.target.type.value, name: event.target.name.value, user: event.target.email.value, country: event.target.country.value, phone: event.target.phone.value, school: event.target.schoolID.value, class: event.target.class.value, lang: event.target.lang.value, start_month: event.target.start_month.value, start_date: event.target.start_date.value, end_date: event.target.end_date.value, anual: event.target.anual, } const JSONdata = JSON.stringify(data) const endpoint = 'https://management.beanstalkedu.com/items/enrolled_user' const options = { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSONdata, } const response = await fetch(endpoint, options) const result = await response.json() alert(`Is this your full name: ${result.data}`) } return (

User Registration Form

{school && school.data.map(data=> )}
{ individualValue &&
{/*
 
 
 
 
*/}
 
 
 
 
 
 
 
 
 
 
}
{/* */}
) }