когда я нажимаю в нижнем логине, я не могу перейти на другую страницу, происходит перенаправление, и данные не извлекаются из выборки, так как у нас есть 3 разных интерфейса, поэтому у нас есть 3 разных пользователя, и у каждого из них есть свой интерфейс.
handleFormSubmit(e) {
e.preventDefault();
let userData = this.state.go;
if (this.state.go.username==='' || this.state.go.password==='') {
alert("Champs vide") ;
}else {
fetch('http://localhost/delv/Backend/api/Authentifier/Login.php',{
method: "POST",
headers: {
'Content-Type': 'application/json',
'Accept': 'application/json'
},
}).then(response => {
console.log(response);
return response.json();
}).then(data => {
console.log(data);
this.setState({
redirectToReferrer: true,
hi:data
});
});
if (this.state.redirectToReferrer === true ){
if (this.state.hi.type==='dispatcheur'){
return <Redirect to='/AcceuilD'/>
console.log("1111");}
else if (this.state.hi==='administrateur') {
return <Redirect to='/AcceuilA/Station'/>
console.log("2222");}
else if (this.state.hi==="station") {
return <Redirect to='/AcceuilS/LancerCommande'/>
console.log("3333");}
else {
return <Redirect to='/authentifier'/>
console.log("4444");}
}
}
}