add profil ok
This commit is contained in:
parent
90e61cebbf
commit
c1352b8eeb
@ -44,12 +44,10 @@ class _AddProfileState extends State<AddProfile> with ShowAlertDialog {
|
||||
TextEditingController inputPasswordConfirmed = TextEditingController();
|
||||
|
||||
onTapFunctionDatePicker({required BuildContext context}) async {
|
||||
DateTime initialDate = DateTime.parse(formatDate(inputBirth.text));
|
||||
|
||||
DateTime? pickedDate = await showDatePicker(
|
||||
context: context,
|
||||
firstDate: DateTime(1900),
|
||||
initialDate: initialDate,
|
||||
initialDate: DateTime.now(),
|
||||
lastDate: DateTime(2104));
|
||||
if (pickedDate == null) return;
|
||||
inputBirth.text = DateFormat("dd/MM/yyyy").format(pickedDate);
|
||||
@ -95,7 +93,7 @@ class _AddProfileState extends State<AddProfile> with ShowAlertDialog {
|
||||
}
|
||||
}
|
||||
|
||||
var urlPut = Uri.parse("${globals.api}/users");
|
||||
var urlPut = Uri.parse("${globals.api}/mail");
|
||||
|
||||
var responsePost = await http.post(urlPut,
|
||||
headers: {
|
||||
@ -108,12 +106,11 @@ class _AddProfileState extends State<AddProfile> with ShowAlertDialog {
|
||||
'firstName': firstName,
|
||||
'password': password,
|
||||
'email': email,
|
||||
'roles': '',
|
||||
'birth': birth.toString()
|
||||
}));
|
||||
print(responsePost.statusCode);
|
||||
if (responsePost.statusCode == 200) {
|
||||
showAlertDialog(context, "Ajout", "Votre utilisateur a été ajouté");
|
||||
showAlertDialog(context, "Creation", "Votre utilisateur a été créé");
|
||||
Navigator.pushReplacement(
|
||||
context, MaterialPageRoute(builder: (_) => LoginDemo()));
|
||||
return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user