gestion des erreurs de token

This commit is contained in:
Valentin CZERYBA 2022-09-07 23:15:54 +02:00
parent be4804fad1
commit 29338f807b

View File

@ -45,7 +45,45 @@ class _LoginDemoState extends State<LoginDemo> {
MaterialPageRoute(
builder: (_) => MyHomePage(title: 'Flutter Demo')));
} else {
showErrorDialog(context, "Probleme d'authentification");
var text = "";
switch (response.statusCode) {
case 400:
{
text = "Requête mal construite";
}
break;
case 406:
{
text = "Mot de passe incorrect";
}
break;
case 404:
{
text = "Utilisateur inconnu";
}
break;
case 403:
{
text = "Utilisateur desactive";
}
break;
case 410:
{
text = "Token invalide";
}
break;
case 500:
{
text = "Probleme interne du serveur";
}
break;
default:
{
text = "Probleme d'authentification inconnu";
}
break;
}
showErrorDialog(context, text);
}
} else {
showErrorDialog(context, "Champ vide");