diff --git a/client/src/Components/Forms/update_user.jsx b/client/src/Components/Forms/update_user.jsx new file mode 100644 index 0000000000000000000000000000000000000000..a30b64cbd282e1f8c5afac951eaccdcaf2c62232 --- /dev/null +++ b/client/src/Components/Forms/update_user.jsx @@ -0,0 +1,60 @@ +import React, { Component } from 'react' +import './forms.css' +import axios from 'axios'; + +export default class Uupdate extends Component{ + constructor(props){ + super(props); + this.state = { + User_id: '', + name: '', + Email: '', + Password: '', + + } + this.handleChange=this.handleChange.bind(this); + this.update=this.update.bind(this); + } + handleChange (event) { + this.setState({ [event.target.name]: event.target.value}); + + } + update(event){ + + const user = { + user_id: this.state.User_id, + name: this.state.name, + email: this.state.Email, + password: this.state.Password, + } + axios.post('http://localhost:5000/user/update/'+this.state.User_id,user) + .then(window.alert("User Updated successfully!")) + .catch(console.error()) + event.preventDefault(); + } + render(){ + return( + <div> + <h3 style={{fontFamily:"Roboto",marginLeft:"20px"}}> + <b>USER UPDATION</b> + </h3> + <form> + + <ul style={{listStyle:"none"}}> + <li><div> + <input type="text" placeholder="User_id" name="User_id" onChange={this.handleChange} required/> + <input type="text" placeholder="User_Name" name="name" onChange={this.handleChange} required/> + </div></li> + <li><div> + <input type="text" placeholder="Email" name="Email" onChange={this.handleChange} required/> + <input type="text" placeholder="Password" name="Password" onChange={this.handleChange} required/> + </div></li> + <li><div> + <input type="submit" value="Update" onClick={this.update}/></div></li> + </ul> + + </form> + </div> + ); + } +} \ No newline at end of file