{
"name": "usa_auto",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.3.2",
"@testing-library/user-event": "^7.1.2",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
state = {
vin: '',
carBrand: '',
carModel: '',
carModification: '',
carYear: '',
carPart: '',
counterpart: '',
description: '',
name: '',
address: '',
phoneNumber: ''
};
ChangeInput = (e) => {
// console.log(e);
const {id, value} = e.target;
this.setState({[id]: value});
// console.log(this.state);
};
onSubmit = (e) => {
e.preventDefault();
const data = this.state;
console.log(data);
fetch("send.php", {
method: "POST",
body: data,
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
}
}).then(response => {
console.log(response.text()).catch(error);
});
};