Fakultas Ilmu Komputer UI

Commit 6b97da65 authored by Ahmad Izzudin Alifyandra's avatar Ahmad Izzudin Alifyandra
Browse files

fix: undefined checking

parent ebb0880d
Pipeline #89122 passed with stage
in 10 minutes and 16 seconds
...@@ -14,7 +14,12 @@ const initialState: IReduxEcosystem = { ...@@ -14,7 +14,12 @@ const initialState: IReduxEcosystem = {
rating: 0, rating: 0,
visibility: "public", visibility: "public",
}, },
members: {}, members: {
supplier: {},
main: {},
customer: {},
support: {},
},
}; };
const ecosystemReducer = ( const ecosystemReducer = (
......
...@@ -96,25 +96,37 @@ const UpdateEcosystemScreen = ({ ...@@ -96,25 +96,37 @@ const UpdateEcosystemScreen = ({
"Silahkan isi kategori ekosistem" "Silahkan isi kategori ekosistem"
); );
return false; return false;
} else if (Object.keys(ecosystem.members["supplier"]).length == 0) { } else if (
ecosystem.members["supplier"] == undefined ||
Object.keys(ecosystem.members["supplier"]).length == 0
) {
Alert.alert( Alert.alert(
"Anggota Supplier Ekosistem Kosong", "Anggota Supplier Ekosistem Kosong",
"Silahkan isi ekosistem kategori" "Silahkan isi ekosistem kategori"
); );
return false; return false;
} else if (Object.keys(ecosystem.members["customer"]).length == 0) { } else if (
ecosystem.members["customer"] == undefined ||
Object.keys(ecosystem.members["customer"]).length == 0
) {
Alert.alert( Alert.alert(
"Anggota Customer Ekosistem Kosong", "Anggota Customer Ekosistem Kosong",
"Silahkan isi ekosistem kategori" "Silahkan isi ekosistem kategori"
); );
return false; return false;
} else if (Object.keys(ecosystem.members["support"]).length == 0) { } else if (
ecosystem.members["support"] == undefined ||
Object.keys(ecosystem.members["support"]).length == 0
) {
Alert.alert( Alert.alert(
"Anggota Support Ekosistem Kosong", "Anggota Support Ekosistem Kosong",
"Silahkan isi ekosistem kategori" "Silahkan isi ekosistem kategori"
); );
return false; return false;
} else if (Object.keys(ecosystem.members["main"]).length == 0) { } else if (
ecosystem.members["main"] == undefined ||
Object.keys(ecosystem.members["main"]).length == 0
) {
Alert.alert( Alert.alert(
"Anggota Main Business Ekosistem Kosong", "Anggota Main Business Ekosistem Kosong",
"Silahkan isi ekosistem kategori" "Silahkan isi ekosistem kategori"
......
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