{"size": 1215, "ext": "js", "max_stars_repo_path": "Contact_app/src/components/delete-todo.component.js", "max_stars_repo_name": "ali2560/node", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Contact_app/src/components/delete-todo.component.js", "max_issues_repo_name": "ali2560/node", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "Contact_app/src/components/delete-todo.component.js", "max_forks_repo_name": "ali2560/node", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3125, "max_line_length": 98, "alphanum_fraction": 0.4757201646}
import React, { Component } from 'react';
import axios from 'axios';

export default class EditContact extends Component {

    constructor(props) {
        super(props);

       
        this.onSubmit = this.onSubmit.bind(this);

        this.state = {
            name: '',
            number: '',
            label: '',
            completed: false
        }
    }
    
    onSubmit(e) {
        e.preventDefault();
        const obj = {
            name: this.state.name,
            number: this.state.number,
            label: this.state.label,
            completed: this.state.completed
        };
        console.log(obj);
        axios.delete('http://localhost:4000/api/remove/'+this.props.match.params.id, obj)
            .then(res => console.log(res.data));
        
        this.props.history.push('/');
    }

    render() {
        return (
            <div>
                <h3 align="center">Delete Contact</h3>
                <form onSubmit={this.onSubmit}>

                    <div className="form-group">
                        <input type="submit" value="Delete Contact" className="btn btn-primary" />
                    </div>
                </form>
            </div>
        )
    }
}