diff --git a/client/src/NewVideoForm.jsx b/client/src/NewVideoForm.jsx index b14f8704d7..2400f3ef7b 100644 --- a/client/src/NewVideoForm.jsx +++ b/client/src/NewVideoForm.jsx @@ -1,5 +1,10 @@ +import React, { useState } from "react"; + import "./NewVideoForm.css"; const NewVideoForm = () => { + const [title, setTitle] = useState(""); + const [src, setSrc] = useState(""); + const handleSubmit = (e) => { e.preventDefault(); @@ -9,10 +14,7 @@ const NewVideoForm = () => { Accept: "application/json", "Content-Type": "application/json", }, - body: JSON.stringify({ - title: e.target.title.value, - src: e.target.src.value, - }), + body: JSON.stringify({ title, src }), }) .then((response) => response.json()) .then((data) => { @@ -28,12 +30,24 @@ const NewVideoForm = () => {

Add New Video

- - + + setTitle(e.target.value)} + required + />
- - + + setSrc(e.target.value)} + required + />