diff --git a/src/pages/add-user-form.jsx b/src/pages/add-user-form.jsx index 44a11f1..55d926f 100644 --- a/src/pages/add-user-form.jsx +++ b/src/pages/add-user-form.jsx @@ -35,7 +35,7 @@ export default function addUserForm (){ }) }, []) - // console.log(school); + // console.log(school); const handleFormsubmit = async (event) => { event.preventDefault() @@ -52,7 +52,7 @@ export default function addUserForm (){ start_month: event.target.start_month.value, start_date: event.target.start_date.value, end_date: event.target.end_date.value, - // user: event.target.user.value, + anual: event.target.anual, } const JSONdata = JSON.stringify(data) const endpoint = 'https://management.beanstalkedu.com/items/enrolled_user' @@ -78,7 +78,6 @@ export default function addUserForm (){

User Registration Form

-
+
@@ -104,29 +103,46 @@ export default function addUserForm (){
-
- { individualValue && -
- - + + + + + + +
+ { individualValue && +
+
+ +
-
+ {/*
@@ -145,10 +161,8 @@ export default function addUserForm (){  
-
-
- +
*/}
@@ -192,9 +206,7 @@ export default function addUserForm (){  
-
-
@@ -218,12 +230,11 @@ export default function addUserForm (){
- +
-
- - } + + }
{/* */} diff --git a/src/pages/add-user-form3.jsx b/src/pages/add-user-form3.jsx new file mode 100644 index 0000000..397dbde --- /dev/null +++ b/src/pages/add-user-form3.jsx @@ -0,0 +1,213 @@ +// https://management.beanstalkedu.com/items/school +// import React from 'react'; +import React, { useState, useEffect } from 'react'; + +import NavBar from '../components/NavBar' +import { type } from 'os'; +import { data } from 'autoprefixer'; +// import { Inter } from 'next/font/google' +export default function addUserForm (){ + const [school, setSchool] = useState(""); + + useEffect(() => { + fetch(`https://management.beanstalkedu.com/items/school`). + then(res => res.json()) + .then(data => {setSchool(data.data) + }) + }, []) + console.log(typeof school); + const handleFormsubmit = async (event) => { + event.preventDefault() + const data = { + "status":"published", + user: event.target.user.value, + // user: event.target.user.value, + } + 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

+
+ +
+ + +
+
+ + + + +
+ {/*
+ + +
*/} +
+ + +
+
+ + +
+
+ + +
+
+ +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+ +
+
+ {/*
+ + +
*/} +
+ +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+
+   + +
+ +
+ {/* */} +
+
+ + +
+
+ + +
+
+ + +
+
+ + {/* */} +
+ +
+
+
+
+ ) +}