Fix retry: show error on failure, reload professional data after reset
- Stop swallowing DELETE errors silently; show snackbar instead - After successful reset, reload professional from server and notify providers Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
dba8eaa709
commit
3e59a1cb4f
@@ -653,8 +653,19 @@ class _StatusCardState extends State<_StatusCard> {
|
|||||||
Future<void> _retry() async {
|
Future<void> _retry() async {
|
||||||
try {
|
try {
|
||||||
await ApiService.instance.delete('/professionals/me');
|
await ApiService.instance.delete('/professionals/me');
|
||||||
} catch (_) {}
|
} catch (e) {
|
||||||
if (mounted) await context.read<AuthProvider>().isAuthenticated();
|
if (mounted) NotificationsService.showSnackbar('Error al reiniciar solicitud: $e');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!mounted) return;
|
||||||
|
await context.read<AuthProvider>().isAuthenticated();
|
||||||
|
if (!mounted) return;
|
||||||
|
// Reload professional data so the form shows fresh state
|
||||||
|
final auth = context.read<AuthProvider>();
|
||||||
|
context.read<ProfessionalProvider>()
|
||||||
|
.getProfessional(auth.user!.id)
|
||||||
|
.then((pro) => context.read<ProfessionalFormProvider>().setProfesional(pro))
|
||||||
|
.catchError((_) => context.read<ProfessionalFormProvider>().setProfesional(Profesional.empty()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
|||||||
Reference in New Issue
Block a user