Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
Luxshan2000 committed Sep 28, 2023
1 parent 5952ff6 commit 75d11bc
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions frontend/src/components/AddItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,18 @@ function AddItems({setItems}) {

const [name,setname] = useState('')

const handleSubmit = async (ev)=>{

ev.preventDefault()
await axios.post("http://51.20.93.112:5000/api/add/item",{name: name } )

setname("")
const handleSubmit = async (ev) => {
ev.preventDefault();

try {
await axios.post("http://51.20.93.112:5000/api/add/item", { name: name });
setname("");
} catch (error) {
// Handle errors, e.g., show an error message to the user
console.error("Error:", error);
}
}




Expand Down

0 comments on commit 75d11bc

Please sign in to comment.