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:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user