improve host Selector component

pull/289/head
vapao 2021-01-22 23:27:47 +08:00
parent f43c31d351
commit 7156d1a0da
1 changed files with 8 additions and 3 deletions

View File

@ -46,9 +46,14 @@ export default observer(function (props) {
function handleSubmit() {
if (props.onOk) {
setLoading(true)
props.onOk(group, selectedRowKeys)
.then(props.onCancel, () => setLoading(false))
setLoading(true);
const res = props.onOk(group, selectedRowKeys);
if (res && res.then) {
res.then(props.onCancel, () => setLoading(false))
} else {
props.onCancel();
setLoading(false)
}
}
}