feat(patient): implement doctor-only patient deletion, alert theme styling, and test auto-cleanup
This commit is contained in:
@@ -61,4 +61,18 @@ class PatientService {
|
||||
throw Exception('Error al actualizar paciente: $e');
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> deletePatient(int id) async {
|
||||
try {
|
||||
final response = await apiClient.dio.delete('/items/pacientes/$id');
|
||||
if (response.statusCode != 200 && response.statusCode != 204) {
|
||||
throw Exception('Error en el servidor al eliminar el paciente');
|
||||
}
|
||||
} on DioException catch (e) {
|
||||
final serverMessage = e.response?.data?['errors']?[0]?['message'] ?? e.message;
|
||||
throw Exception('Error al eliminar paciente: $serverMessage');
|
||||
} catch (e) {
|
||||
throw Exception('Error al eliminar paciente: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user