Skip to content

Commit

Permalink
fix bug of approveform not showing channel
Browse files Browse the repository at this point in the history
Signed-off-by: YoungHypo <[email protected]>
  • Loading branch information
YoungHypo committed Jan 18, 2025
1 parent 0cfe556 commit b5c24b5
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions src/dashboard/src/pages/ChainCode/forms/ApproveForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const FormItem = Form.Item;
const ApproveForm = props => {
const [form] = Form.useForm();
const intl = useIntl();
const [channels, setChannels] = useState();
const [channels, setChannels] = useState([]);
const {
approveModalVisible,
handleApprove,
Expand All @@ -20,11 +20,15 @@ const ApproveForm = props => {
} = props;

useEffect(() => {
async function fecthData() {
async function fetchData() {
const response = await listChannel();
setChannels(response.data.data);
const newChannels = Object.keys(response.data.data).map(item => ({
label: response.data.data[item].name,
value: response.data.data[item].name
}));
setChannels(newChannels);
}
fecthData();
fetchData();
}, []);

const approveCallback = response => {
Expand Down Expand Up @@ -107,7 +111,7 @@ const ApproveForm = props => {
id: 'app.chainCode.form.approve.channel',
defaultMessage: 'Please select channel',
})}
name="channel"
name="channels"
rules={[
{
required: true,
Expand All @@ -120,9 +124,8 @@ const ApproveForm = props => {
>
<Select
mode="multiple"
options={channels} // dummyChannels changed
options={channels}
tagRender={tagRender}
defaultValue={[]}
dropdownClassName={styles.dropdownClassName}
/>
</FormItem>
Expand Down

0 comments on commit b5c24b5

Please sign in to comment.