File tree Expand file tree Collapse file tree
frontend/app/[locale]/admin/shop/products/_components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -674,13 +674,22 @@ export function ProductForm({
674674 setSlugError ( 'This slug is already used. Try changing the title.' ) ;
675675 }
676676
677+ const photoErrorFields = new Set ( [
678+ 'image' ,
679+ 'photos' ,
680+ 'photoPlan' ,
681+ 'newImages' ,
682+ 'newImageUploadIds' ,
683+ ] ) ;
684+
677685 if (
686+ ( typeof data . field === 'string' &&
687+ photoErrorFields . has ( data . field ) ) ||
678688 data . code === 'IMAGE_UPLOAD_FAILED' ||
679- data . code === 'IMAGE_REQUIRED' ||
680- data . field === 'image' ||
681- data . field === 'photos'
689+ data . code === 'IMAGE_REQUIRED'
682690 ) {
683691 setImageError ( data . error ?? 'Failed to update product photos' ) ;
692+ return ;
684693 }
685694
686695 if ( data . code === 'SALE_ORIGINAL_REQUIRED' ) {
@@ -698,6 +707,7 @@ export function ProductForm({
698707 setError ( data . error ?? msg ) ;
699708 return ;
700709 }
710+
701711 if (
702712 response . status === 403 &&
703713 ( data . code === 'CSRF_MISSING' || data . code === 'CSRF_INVALID' )
You can’t perform that action at this time.
0 commit comments