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