diff --git a/spug_web/src/pages/host/Selector.js b/spug_web/src/pages/host/Selector.js index b084045..e4abdaa 100644 --- a/spug_web/src/pages/host/Selector.js +++ b/spug_web/src/pages/host/Selector.js @@ -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) + } } }