don't set empty key into to Appfile

This commit is contained in:
zzxwill
2021-02-08 19:29:29 +08:00
parent d404ae9459
commit 8a3b8a29a7
@@ -71,12 +71,31 @@ export default (): React.ReactNode => {
if (valid.length > 0) {
alert(`invalid${valid.toString()}`);
}
const servicesDict = {}
servicesDict[serviceName] = {
type: workloadType,
formData,
}
Object.entries(formData).forEach((([key, value]) => {
// eslint-disable-next-line default-case
switch (typeof value) {
case "number":
servicesDict[serviceName][key] = value
break
case "string":
if ((value === null) || (value === "")){
break
}
servicesDict[serviceName][key] = value
break
case "object":
if ((Array.isArray(value) && value.length)) {
servicesDict[serviceName][key] = value
break
}
}
}))
const appFile = {
name: applicationName,
services: servicesDict,