CEC-1965 Cleanup (#163)

This commit is contained in:
John Wu
2022-07-01 13:00:26 -07:00
committed by GitHub
parent fe40c26c56
commit 86418d093c
5 changed files with 49 additions and 81 deletions

View File

@@ -7,27 +7,31 @@ export const validateSupplier = (supplier) => {
validateEmail(supplier.email);
if (supplier.contact.length === 0) {
if (!supplier?.id) {
throw new Error("id required");
}
if (!supplier?.contact) {
throw new Error("contact required");
}
if (supplier.company.length === 0) {
if (!supplier?.company) {
throw new Error("company required");
}
if (supplier.address.length === 0) {
if (!supplier?.address) {
throw new Error("address required");
}
if (supplier.telephone.length === 0) {
if (!supplier?.telephone) {
throw new Error("telephone required");
}
if (supplier.program.length === 0) {
if (!supplier?.program) {
throw new Error("program required");
}
if (supplier.ecus.length === 0) {
if (!supplier?.ecus) {
throw new Error("ecus required");
}
};