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

@@ -15,7 +15,7 @@ import { DatePicker } from '@/components/ui/date-picker';
import { FlexibleDateInput, type DatePrecision } from '@/components/ui/flexible-date-input';
import { SlugField } from '@/components/ui/slug-field';
import { toast } from '@/hooks/use-toast';
import { getErrorMessage } from '@/lib/errorHandler';
import { handleError } from '@/lib/errorHandler';
import { MapPin, Save, X, Plus } from 'lucide-react';
import { toDateOnly } from '@/lib/dateUtils';
import { Badge } from '@/components/ui/badge';
@@ -193,12 +193,16 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
? "The park information has been updated successfully."
: "The new park has been created successfully."
});
} catch (error) {
const errorMsg = getErrorMessage(error);
toast({
title: "Error",
description: errorMsg,
variant: "destructive"
} catch (error: unknown) {
handleError(error, {
action: isEditing ? 'Update Park' : 'Create Park',
userId: user?.id,
metadata: {
parkName: data.name,
hasLocation: !!data.location_id,
hasNewOperator: !!tempNewOperator,
hasNewOwner: !!tempNewPropertyOwner
}
});
} finally {
setSubmitting(false);