I am using a JSON (local file) as a database, I get data for a login, at the same time I register the users and I recover all this in a JSON
Example:
{
"MWDB": {
"users": [
{
"name": "Admin",
"surname": "Admin",
"user": "Admin",
"password": "admin",
"type": 1
},
{
"name": "Said",
"surname": "Soria",
"user": "saidsz",
"password": "1234",
"type": 1
}
]
}
}
this.state ={
name: '',
surname: '',
user: '',
password: ''
};
this.handleChange = this.handleChange.bind(this);
handleChange(e){
let target = e.target;
let value = target.type === 'checkbox' ? target.checked : target.value;
let name = target.name;
this.setState({
[name]: value
});
}
handleSubmit(e){
e.preventDefault();
console.log("Data:");
console.log(this.state);
}
I am using ReactJs on a MacBook Air with macOS Mojave 10.14.3
Aucun commentaire:
Enregistrer un commentaire