confirmCorisOtp function
Implementation
Future<Map<String, dynamic>?> confirmCorisOtp(
Map<String, dynamic> dataWithOtp) async {
try {
final response = await http.post(
Uri.parse(_apiUrl),
headers: {'Content-Type': 'application/json'},
body: jsonEncode(dataWithOtp),
);
final decoded = jsonDecode(response.body);
if (decoded is Map<String, dynamic>) {
return decoded;
} else {
return {'message': 'Réponse inattendue du serveur.'};
}
} catch (e) {
return {'message': 'Erreur lors de la validation de l\'OTP.'};
}
}