Fakultas Ilmu Komputer UI
Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
ppl-fasilkom-ui
PPL KI Ganjil 2021 2022
Clicks - Ecosystem Business
clicks-frontend
Commits
ce3d82fb
Commit
ce3d82fb
authored
Dec 04, 2021
by
Bagus Prabowo
Browse files
fix: Create Ecosystem Error Handling Fix
parent
74fe6a9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/screens/CreateEcosystemScreen.tsx
View file @
ce3d82fb
...
...
@@ -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"
/>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment