Fakultas Ilmu Komputer UI

Commit 1ea53e4b authored by Bagus Prabowo's avatar Bagus Prabowo
Browse files

Merge branch 'create-ecosystem-fix' into 'master'

fix: Create Ecosystem Error Handling Fix

See merge request !160
parents 74fe6a9c ce3d82fb
Pipeline #88947 passed with stage
in 10 minutes and 37 seconds
......@@ -154,56 +154,66 @@ const CreateEcosystemScreen = ({
};
const errorHandling = () => {
if (ecosystemName == null) {
return Alert.alert(
"Nama Ekosistem Kosong",
"Silahkan isi nama ekosistem"
);
if (pic == "") {
Alert.alert("Foto Ekosistem Kosong", "Silahkan isi foto ekosistem");
return false;
} else if (ecosystemName == "") {
Alert.alert("Nama Ekosistem Kosong", "Silahkan isi nama ekosistem");
return false;
} else if (ecosystemName.length < 5) {
return Alert.alert(
Alert.alert(
"Nama Ekosistem Terlalu Pendek",
"Nama ekosistem minimal 5 karakter"
);
} else if (ecosystemDetails == null) {
return Alert.alert(
return false;
} else if (ecosystemDetails == "") {
Alert.alert(
"Detail Ekosistem Kosong",
"Silahkan isi nama detail ekosistem"
);
return false;
} else if (ecosystemDetails.length < 10) {
return Alert.alert(
"Nama Ekosistem Terlalu Pendek",
Alert.alert(
"Detail Ekosistem Terlalu Pendek",
"Detail ekosistem minimal 10 karakter"
);
} else if (ecosystemCategory == null) {
return Alert.alert(
return false;
} else if (ecosystemCategory == "") {
Alert.alert(
"Kategori Ekosistem Kosong",
"Silahkan isi kategori ekosistem"
);
} else if (ecosystemSupplier[1] == null) {
return Alert.alert(
return false;
} else if (Object.keys(ecosystemSupplier).length == 0) {
Alert.alert(
"Anggota Supplier Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
} else if (ecosystemCustomer[1] == null) {
return Alert.alert(
return false;
} else if (Object.keys(ecosystemCustomer).length == 0) {
Alert.alert(
"Anggota Customer Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
} else if (ecosystemSupport[1] == null) {
return Alert.alert(
return false;
} else if (Object.keys(ecosystemSupport).length == 0) {
Alert.alert(
"Anggota Support Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
} else if (ecosystemMainBusiness[1] == null) {
return Alert.alert(
return false;
} else if (Object.keys(ecosystemMainBusiness).length == 0) {
Alert.alert(
"Anggota Main Business Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
return false;
} else {
return true;
}
};
const handleSubmit = async () => {
errorHandling();
setIsSubmitting(true);
const ecosystemCategoryMembers: {
categoryMember: IEcosystemCategoryMember;
......@@ -786,7 +796,9 @@ const CreateEcosystemScreen = ({
text="Lanjut"
colors="primary"
onPress={() => {
handleSubmit();
if (errorHandling()) {
handleSubmit();
}
}}
/>
<Spacer variant="xl" />
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment