mirror of
https://github.com/pacnpal/thrilltrack-explorer.git
synced 2025-12-22 05:11:14 -05:00
Fix: Block photo uploads on entity edits
This commit is contained in:
@@ -200,6 +200,19 @@ export function ParkForm({ onSubmit, onCancel, initialData, isEditing = false }:
|
||||
|
||||
const handleFormSubmit = async (data: ParkFormData) => {
|
||||
try {
|
||||
// CRITICAL: Block new photo uploads on edits
|
||||
if (isEditing && data.images?.uploaded) {
|
||||
const hasNewPhotos = data.images.uploaded.some(img => img.isLocal);
|
||||
if (hasNewPhotos) {
|
||||
toast({
|
||||
variant: 'destructive',
|
||||
title: 'Validation Error',
|
||||
description: 'New photos cannot be added during edits. Please remove new photos or use the photo gallery.'
|
||||
});
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Build composite submission if new entities were created
|
||||
const submissionContent: any = {
|
||||
park: data,
|
||||
|
||||
Reference in New Issue
Block a user