优化代码

pull/47/head
smallbun 2023-09-10 22:24:38 +08:00
parent 62fa1b3edc
commit 941f07361e
3 changed files with 7 additions and 7 deletions

View File

@ -42,9 +42,9 @@ export default (props: CreateModelProps) => {
wrapperCol={{ span: 19 }}
onFinish={async (values: Record<string, string>) => {
setLoading(true);
const result = await onFinish(values);
setLoading(false);
return !!result;
await onFinish(values).finally(() => {
setLoading(false);
});
}}
modalProps={{
destroyOnClose: true,

View File

@ -78,7 +78,7 @@ export default (props: CreateOrganizationFormProps<AccountAPI.CreateOrganization
*/
const cancel = async () => {
if (onCancel) {
await onCancel();
onCancel();
}
form.resetFields();
};

View File

@ -83,9 +83,9 @@ export default (props: CreateDrawerProps) => {
{...DRAWER_FORM_ITEM_LAYOUT}
onFinish={async (values: Record<string, string>) => {
setLoading(true);
const result = await onFinish(values);
setLoading(false);
return !!result;
await onFinish(values).finally(() => {
setLoading(false);
});
}}
>
<Spin spinning={loading}>