Fakultas Ilmu Komputer UI

Commit c984e352 authored by Bagus Prabowo's avatar Bagus Prabowo
Browse files

chore: added error handling and constraints

parent 3073c42b
Pipeline #88299 passed with stage
in 10 minutes and 13 seconds
......@@ -152,20 +152,57 @@ const CreateEcosystemScreen = ({
}
};
const handleSubmit = async () => {
if (
ecosystemSupport[1] == null ||
ecosystemCustomer[1] == null ||
ecosystemSupplier[1] == null ||
ecosystemMainBusiness[1] == null
) {
Alert.alert(
"Anggota Ekosistem Kategori Kosong",
const errorHandling = () => {
if (ecosystemName == null) {
return Alert.alert(
"Nama Ekosistem Kosong",
"Silahkan isi nama ekosistem"
);
} else if (ecosystemName.length < 5) {
return Alert.alert(
"Nama Ekosistem Terlalu Pendek",
"Nama ekosistem minimal 5 karakter"
);
} else if (ecosystemDetails == null) {
return Alert.alert(
"Detail Ekosistem Kosong",
"Silahkan isi nama detail ekosistem"
);
} else if (ecosystemDetails.length < 10) {
return Alert.alert(
"Nama Ekosistem Terlalu Pendek",
"Detail ekosistem minimal 10 karakter"
);
} else if (ecosystemCategory == null) {
return Alert.alert(
"Kategori Ekosistem Kosong",
"Silahkan isi kategori ekosistem"
);
} else if (ecosystemSupplier[1] == null) {
return Alert.alert(
"Anggota Supplier Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
} else if (ecosystemCustomer[1] == null) {
return Alert.alert(
"Anggota Customer Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
} else if (ecosystemSupport[1] == null) {
return Alert.alert(
"Anggota Support Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
} else if (ecosystemMainBusiness[1] == null) {
return Alert.alert(
"Anggota Main Business Ekosistem Kosong",
"Silahkan isi ekosistem kategori"
);
return;
}
};
const handleSubmit = async () => {
errorHandling();
setIsSubmitting(true);
const ecosystemCategoryMembers: {
categoryMember: IEcosystemCategoryMember;
......
Markdown is supported
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