feat(#112): aligner reprise front sur dossier complet GET/PATCH

Préremplit parents, enfants, motivation et fiche AM depuis reprise-dossier
et envoie le body PATCH complet (co-parent, enfants par id, champs pro AM).

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-16 16:46:51 +02:00
co-authored by Cursor
parent 25c10c885a
commit f300505225
11 changed files with 439 additions and 92 deletions
+5 -28
View File
@@ -291,43 +291,20 @@ class AuthService {
}
/// Resoumission après refus. PATCH /auth/reprise-resoumettre. Ticket #112.
static Future<void> resoumettreReprise({
required String token,
String? prenom,
String? nom,
String? telephone,
String? adresse,
String? ville,
String? codePostal,
String? photoUrl,
}) async {
final cleaned = token.trim();
static Future<void> resoumettreReprise(Map<String, dynamic> body) async {
final cleaned = body['token']?.toString().trim() ?? '';
if (cleaned.isEmpty) {
throw Exception('Lien invalide ou expiré.');
}
final body = <String, dynamic>{'token': cleaned};
if (prenom != null && prenom.trim().isNotEmpty) body['prenom'] = prenom.trim();
if (nom != null && nom.trim().isNotEmpty) body['nom'] = nom.trim();
if (telephone != null && telephone.trim().isNotEmpty) {
body['telephone'] = telephone.trim();
}
if (adresse != null && adresse.trim().isNotEmpty) {
body['adresse'] = adresse.trim();
}
if (ville != null && ville.trim().isNotEmpty) body['ville'] = ville.trim();
if (codePostal != null && codePostal.trim().isNotEmpty) {
body['code_postal'] = codePostal.trim();
}
if (photoUrl != null && photoUrl.trim().isNotEmpty) {
body['photo_url'] = photoUrl.trim();
}
final payload = Map<String, dynamic>.from(body);
payload['token'] = cleaned;
late final http.Response response;
try {
response = await http.patch(
Uri.parse('${ApiConfig.baseUrl}${ApiConfig.repriseResoumettre}'),
headers: ApiConfig.headers,
body: jsonEncode(body),
body: jsonEncode(payload),
);
} on http.ClientException {
throw Exception(