fix: update image handling in ProductOptionFormPage to store file URL instead of internal ID

This commit is contained in:
hosseintaromi 2025-08-02 21:03:47 +03:30
parent 025d9de1d7
commit 93b116673e
1 changed files with 2 additions and 1 deletions

View File

@ -131,7 +131,8 @@ const ProductOptionFormPage = () => {
url: result.url url: result.url
}; };
setUploadedImage(imageData); setUploadedImage(imageData);
setValue('maintenance.image', result.id, { shouldValidate: true, shouldDirty: true }); // Store the file URL (not the internal id) in the form state so the backend receives the URL
setValue('maintenance.image', result.url, { shouldValidate: true, shouldDirty: true });
return result; return result;
} catch (error) { } catch (error) {
console.error('Upload error:', error); console.error('Upload error:', error);