mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 08:51:12 -05:00
Fix designer form validation
This commit is contained in:
@@ -99,19 +99,19 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
|
||||
|
||||
setIsSubmitting(true);
|
||||
try {
|
||||
const formData = {
|
||||
...data,
|
||||
founded_year: data.founded_year ? parseInt(String(data.founded_year)) : undefined,
|
||||
};
|
||||
|
||||
if (initialData?.id) {
|
||||
await submitOperatorUpdate(initialData.id, formData, user.id);
|
||||
toast.success('Operator update submitted for review');
|
||||
} else {
|
||||
await submitOperatorCreation(formData, user.id);
|
||||
toast.success('Operator submitted for review');
|
||||
}
|
||||
onCancel();
|
||||
const formData = {
|
||||
...data,
|
||||
company_type: 'operator' as const,
|
||||
founded_year: data.founded_year ? parseInt(String(data.founded_year)) : undefined,
|
||||
};
|
||||
|
||||
await onSubmit(formData);
|
||||
|
||||
// Only show success toast and close if not editing through moderation queue
|
||||
if (!initialData?.id) {
|
||||
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');
|
||||
|
||||
Reference in New Issue
Block a user