summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/page.tsx24
1 files changed, 15 insertions, 9 deletions
diff --git a/app/page.tsx b/app/page.tsx
index b3c00b8..f295c33 100644
--- a/app/page.tsx
+++ b/app/page.tsx
@@ -100,21 +100,27 @@ export default function Home() {
event.preventDefault();
setIsLoading(true);
- const needDispatch = isDispatch;
- const needDriver = isDriver;
-
- if (!barcode || !imageSj || (!imagePackage && needDriver)) {
- alert("Barcode, Foto SJ, dan Foto Penerima harus tersedia.");
+ if (!barcode) {
+ alert("Barcode harus diisi.");
setIsLoading(false);
return;
}
- if (!barcode || (!imageDispatch && needDispatch)) {
- alert("Foto Dispatch Wajib Diisi");
- setIsLoading(false);
- return;
+ if (isDispatch) {
+ if (!imageDispatch) {
+ alert("Foto Dispatch Wajib Diisi");
+ setIsLoading(false);
+ return;
+ }
+ } else {
+ if (!imageSj || !imagePackage) {
+ alert("Barcode, Foto SJ, dan Foto Penerima harus tersedia.");
+ setIsLoading(false);
+ return;
+ }
}
+
try {
// const newSjImage = imageSj.replace(/^.*?,/, "");
// const newPackageImage = imagePackage.replace(/^.*?,/, "");