refactor: remove mandatory image validation for product variants and improve error handling in owner verification actions
This commit is contained in:
parent
ad73da5885
commit
8eee3b04ce
@ -681,12 +681,6 @@ private function applyVariantImageChanges(
|
||||
}
|
||||
|
||||
$this->copyRequestVariantImages($verificationRequest, $index, $variant);
|
||||
|
||||
if ($variant->getMedia('images')->isEmpty()) {
|
||||
throw ValidationException::withMessages([
|
||||
"variants.{$index}.images" => 'Foto varian wajib diisi.',
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
private function copyRequestVariantImages(OwnerVerificationRequest $verificationRequest, int $index, ProductVariant $variant): void
|
||||
|
||||
@ -55,8 +55,10 @@ function submitApprove() {
|
||||
.post(approveUrl.value, {
|
||||
preserveScroll: true,
|
||||
onError: (errors: Record<string, string>) => {
|
||||
if (errors.system) {
|
||||
toast.error(errors.system);
|
||||
const firstError = Object.values(errors)[0];
|
||||
|
||||
if (firstError) {
|
||||
toast.error(firstError);
|
||||
}
|
||||
},
|
||||
});
|
||||
@ -71,8 +73,10 @@ function submitReject() {
|
||||
rejectForm.reset();
|
||||
},
|
||||
onError: (errors: Record<string, string>) => {
|
||||
if (errors.system) {
|
||||
toast.error(errors.system);
|
||||
const firstError = Object.values(errors)[0];
|
||||
|
||||
if (firstError) {
|
||||
toast.error(firstError);
|
||||
}
|
||||
},
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user