mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-21 15:11:12 -05:00
Fix designer form validation
This commit is contained in:
@@ -101,17 +101,17 @@ export function DesignerForm({ onSubmit, onCancel, initialData }: DesignerFormPr
|
||||
try {
|
||||
const formData = {
|
||||
...data,
|
||||
company_type: 'designer' as const,
|
||||
founded_year: data.founded_year ? parseInt(String(data.founded_year)) : undefined,
|
||||
};
|
||||
|
||||
if (initialData?.id) {
|
||||
await submitDesignerUpdate(initialData.id, formData, user.id);
|
||||
toast.success('Designer update submitted for review');
|
||||
} else {
|
||||
await submitDesignerCreation(formData, user.id);
|
||||
await onSubmit(formData);
|
||||
|
||||
// Only show success toast and close if not editing through moderation queue
|
||||
if (!initialData?.id) {
|
||||
toast.success('Designer submitted for review');
|
||||
}
|
||||
onCancel();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Submission error:', error);
|
||||
toast.error(error instanceof Error ? error.message : 'Failed to submit designer');
|
||||
|
||||
@@ -104,17 +104,17 @@ export function ManufacturerForm({ onSubmit, onCancel, initialData }: Manufactur
|
||||
try {
|
||||
const formData = {
|
||||
...data,
|
||||
company_type: 'manufacturer' as const,
|
||||
founded_year: data.founded_year ? parseInt(String(data.founded_year)) : undefined,
|
||||
};
|
||||
|
||||
if (initialData?.id) {
|
||||
await submitManufacturerUpdate(initialData.id, formData, user.id);
|
||||
toast.success('Manufacturer update submitted for review');
|
||||
} else {
|
||||
await submitManufacturerCreation(formData, user.id);
|
||||
await onSubmit(formData);
|
||||
|
||||
// Only show success toast and close if not editing through moderation queue
|
||||
if (!initialData?.id) {
|
||||
toast.success('Manufacturer submitted for review');
|
||||
}
|
||||
onCancel();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Submission error:', error);
|
||||
toast.error(error instanceof Error ? error.message : 'Failed to submit manufacturer');
|
||||
|
||||
@@ -101,17 +101,17 @@ export function OperatorForm({ onSubmit, onCancel, initialData }: OperatorFormPr
|
||||
try {
|
||||
const formData = {
|
||||
...data,
|
||||
company_type: 'operator' as const,
|
||||
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);
|
||||
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');
|
||||
|
||||
@@ -127,17 +127,17 @@ export function PropertyOwnerForm({ onSubmit, onCancel, initialData }: PropertyO
|
||||
try {
|
||||
const formData = {
|
||||
...data,
|
||||
company_type: 'property_owner' as const,
|
||||
founded_year: data.founded_year ? parseInt(String(data.founded_year)) : undefined,
|
||||
};
|
||||
|
||||
if (initialData?.id) {
|
||||
await submitPropertyOwnerUpdate(initialData.id, formData, user.id);
|
||||
toast.success('Property owner update submitted for review');
|
||||
} else {
|
||||
await submitPropertyOwnerCreation(formData, user.id);
|
||||
await onSubmit(formData);
|
||||
|
||||
// Only show success toast and close if not editing through moderation queue
|
||||
if (!initialData?.id) {
|
||||
toast.success('Property owner submitted for review');
|
||||
}
|
||||
onCancel();
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('Submission error:', error);
|
||||
toast.error(error instanceof Error ? error.message : 'Failed to submit property owner');
|
||||
|
||||
Reference in New Issue
Block a user