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);
|
$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
|
private function copyRequestVariantImages(OwnerVerificationRequest $verificationRequest, int $index, ProductVariant $variant): void
|
||||||
|
|||||||
@ -55,8 +55,10 @@ function submitApprove() {
|
|||||||
.post(approveUrl.value, {
|
.post(approveUrl.value, {
|
||||||
preserveScroll: true,
|
preserveScroll: true,
|
||||||
onError: (errors: Record<string, string>) => {
|
onError: (errors: Record<string, string>) => {
|
||||||
if (errors.system) {
|
const firstError = Object.values(errors)[0];
|
||||||
toast.error(errors.system);
|
|
||||||
|
if (firstError) {
|
||||||
|
toast.error(firstError);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
@ -71,8 +73,10 @@ function submitReject() {
|
|||||||
rejectForm.reset();
|
rejectForm.reset();
|
||||||
},
|
},
|
||||||
onError: (errors: Record<string, string>) => {
|
onError: (errors: Record<string, string>) => {
|
||||||
if (errors.system) {
|
const firstError = Object.values(errors)[0];
|
||||||
toast.error(errors.system);
|
|
||||||
|
if (firstError) {
|
||||||
|
toast.error(firstError);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user