OSDN Git Service

fixes the key index check, fixes https://github.com/Bytom/bytom/issues/699
authorZhiting Lin <zlin035@uottawa.ca>
Tue, 9 Oct 2018 06:15:08 +0000 (14:15 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Tue, 9 Oct 2018 06:15:08 +0000 (14:15 +0800)
src/features/accounts/components/New.jsx
src/features/assets/components/New.jsx
src/features/shared/components/XpubField/XpubField.scss

index c789df2..9f73051 100644 (file)
@@ -52,7 +52,7 @@ class Form extends React.Component {
 }
 
 const validate = ( values, props ) => {
-  const errors = {}
+  const errors = { xpubs:{} }
   const lang = props.lang
 
   const tagError = JsonField.validator(values.tags)
@@ -60,6 +60,12 @@ const validate = ( values, props ) => {
 
   if (!values.alias) { errors.alias = ( lang === 'zh' ? '账户别名是必须项' : 'Account alias is required' ) }
 
+  values.xpubs.forEach((xpub, index) => {
+    if (!values.xpubs[index].value) {
+      errors.xpubs[index] = {...errors.xpubs[index], value: ( lang === 'zh' ? '请输入或选择密钥' : 'Please provide keys' )}
+    }
+  })
+
   return errors
 }
 
index 8e2a860..2d1ab42 100644 (file)
@@ -52,7 +52,7 @@ class Form extends React.Component {
 }
 
 const validate = (values,props) => {
-  const errors = {}
+  const errors = { xpubs:{} }
   const lang = props.lang
 
   const jsonFields = ['definition']
@@ -63,6 +63,12 @@ const validate = (values,props) => {
 
   if (!values.alias) { errors.alias = ( lang === 'zh' ? '资产别名是必须项' :'Asset alias is required' ) }
 
+  values.xpubs.forEach((xpub, index) => {
+    if (!values.xpubs[index].value) {
+      errors.xpubs[index] = {...errors.xpubs[index], value: ( lang === 'zh' ? '请输入或选择密钥' : 'Please provide keys' )}
+    }
+  })
+
   return errors
 }
 
index a08cef4..30e5168 100644 (file)
@@ -22,6 +22,7 @@
 
 .label {
   width: 220px;
+  vertical-align: top;
 
   label {
     font-weight: normal;