From 7ffba324e67fbe17ae69efda51912f532d644533 Mon Sep 17 00:00:00 2001 From: suvodip ghosh Date: Sat, 13 May 2023 14:45:12 +0530 Subject: [PATCH] sid --- src/pages/edit-school.jsx | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/pages/edit-school.jsx b/src/pages/edit-school.jsx index dd454b6..5491024 100644 --- a/src/pages/edit-school.jsx +++ b/src/pages/edit-school.jsx @@ -13,7 +13,8 @@ export default function addSchoolForm() { const [phoneValue, setphoneValue] = useState() const [allStates, setAllStates] = useState([]) const [allCities, setAllCities] = useState([]) - + + const handleSelectAllStates = stateCode => { setAllCities([]) fetch(`https://api.siliconpin.com/v3/list/country/city/?country=${countryValue.value}&state=${stateCode.value}`) @@ -47,7 +48,24 @@ export default function addSchoolForm() { setCountryValue(countryValue) } const router = useRouter() - console.log(router.query.school) + let sid= router.query.school + + + + if(sid){ + const [school, setSchool] = useState([]); + const fetchData = async () => { + const response = await fetch("https://management.beanstalkedu.com/items/school?filter[status][_eq]=published&school="+sid); + const data = await response.json(); + return setSchool(data.data); + } + console.log(school) + + useEffect(() => { + fetchData(); + },[]) + } + // console.log(phoneValue) // const selectCountry = countryValue => { // setCountryValue(countryValue)