@@ -9,7 +9,7 @@ const FormItem = Form.Item;
99const ApproveForm = props => {
1010 const [ form ] = Form . useForm ( ) ;
1111 const intl = useIntl ( ) ;
12- const [ channels , setChannels ] = useState ( ) ;
12+ const [ channels , setChannels ] = useState ( [ ] ) ;
1313 const {
1414 approveModalVisible,
1515 handleApprove,
@@ -20,11 +20,15 @@ const ApproveForm = props => {
2020 } = props ;
2121
2222 useEffect ( ( ) => {
23- async function fecthData ( ) {
23+ async function fetchData ( ) {
2424 const response = await listChannel ( ) ;
25- setChannels ( response . data . data ) ;
25+ const newChannels = Object . keys ( response . data . data ) . map ( item => ( {
26+ label : response . data . data [ item ] . name ,
27+ value : response . data . data [ item ] . name ,
28+ } ) ) ;
29+ setChannels ( newChannels ) ;
2630 }
27- fecthData ( ) ;
31+ fetchData ( ) ;
2832 } , [ ] ) ;
2933
3034 const approveCallback = response => {
@@ -107,7 +111,7 @@ const ApproveForm = props => {
107111 id : 'app.chainCode.form.approve.channel' ,
108112 defaultMessage : 'Please select channel' ,
109113 } ) }
110- name = "channel "
114+ name = "channels "
111115 rules = { [
112116 {
113117 required : true ,
@@ -120,9 +124,8 @@ const ApproveForm = props => {
120124 >
121125 < Select
122126 mode = "multiple"
123- options = { channels } // dummyChannels changed
127+ options = { channels }
124128 tagRender = { tagRender }
125- defaultValue = { [ ] }
126129 dropdownClassName = { styles . dropdownClassName }
127130 />
128131 </ FormItem >
0 commit comments