OSDN Git Service

fixed the logic in the create action
authorZhiting Lin <zlin035@uottawa.ca>
Tue, 16 Apr 2019 06:09:57 +0000 (14:09 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Tue, 16 Apr 2019 06:09:57 +0000 (14:09 +0800)
src/features/shared/actions/create.js

index 8c05c02..e419382 100644 (file)
@@ -29,14 +29,16 @@ export default function(type, options = {}) {
         data[fieldName] = parseInt(data[fieldName])
       })
 
-      if(data.definition.description.length === 0 ){
-        data.definition.description = {}
-      }else {
-        const description = {}
-        data.definition.description.forEach(key => {
-          description[key.key] = key.value
-        })
-        data.definition.description = description
+      if(data.definition && data.definition.description ){
+        if(data.definition.description.length === 0 ){
+          data.definition.description = {}
+        }else {
+          const description = {}
+          data.definition.description.forEach(key => {
+            description[key.key] = key.value
+          })
+          data.definition.description = description
+        }
       }
 
       if (data.xpubs) {