diff --git a/client/src/Components/Forms/remove_book.jsx b/client/src/Components/Forms/remove_book.jsx new file mode 100644 index 0000000000000000000000000000000000000000..b9ea14d797c69859fa7c70343fa13be1ee76cef3 --- /dev/null +++ b/client/src/Components/Forms/remove_book.jsx @@ -0,0 +1,43 @@ +import React, { Component } from 'react'; +import './forms.css'; +import axios from 'axios'; + +export default class Bdel extends Component{ + constructor(props){ + super(props); + this.state = { + book_id: '' + } + this.handleChange=this.handleChange.bind(this); + this.remove=this.remove.bind(this); + } + handleChange(event){ + this.setState({ + book_id : event.target.value + }); + + } + remove(event){ + axios.delete('http://localhost:5000/book/'+this.state.book_id) + .then( + window.alert((this.state.book_id.toString()).concat(" is removed!")) + ) + event.preventDefault(); + } + render(){ + return( + <div> + <h3 style={{fontFamily:"Roboto",marginLeft:"20px"}}> + <b>REMOVE BOOK</b> + </h3> + <form> + <div><input type="text" placeholder="Book_id" style={{marginLeft:"30px"}} onChange={this.handleChange} required/></div> + + <div><input type="submit" value="Remove" style={{marginBottom:"20px"}} onClick={this.remove}/></div> + + + </form> + </div> + ) + } +} \ No newline at end of file