feature/add-user #35

Merged
v4l3n71n merged 4 commits from feature/add-user into main 2025-02-14 20:21:06 +00:00
Showing only changes of commit c1352b8eeb - Show all commits

View File

@ -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;