Refactor: Execute remaining phases

This commit is contained in:
gpt-engineer-app[bot]
2025-10-20 13:30:02 +00:00
parent 6f1baef8c0
commit 368b97da04
10 changed files with 167 additions and 105 deletions

View File

@@ -19,6 +19,7 @@ import { FlexibleDateInput, type DatePrecision } from '@/components/ui/flexible-
import { submitOperatorCreation, submitOperatorUpdate } from '@/lib/entitySubmissionHelpers';
import { useAuth } from '@/hooks/useAuth';
import { toast } from 'sonner';
import { handleError } from '@/lib/errorHandler';
import { useNavigate } from 'react-router-dom';
import type { UploadedImage } from '@/types/company';
@@ -113,9 +114,11 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
toast.success('Operator submitted for review');
onCancel();
}
} catch (error) {
console.error('Submission error:', error);
toast.error(error instanceof Error ? error.message : 'Failed to submit operator');
} catch (error: unknown) {
handleError(error, {
action: initialData?.id ? 'Update Operator' : 'Create Operator',
metadata: { companyName: data.name }
});
} finally {
setIsSubmitting(false);
}