优化代码

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 }} wrapperCol={{ span: 19 }}
onFinish={async (values: Record<string, string>) => { onFinish={async (values: Record<string, string>) => {
setLoading(true); setLoading(true);
const result = await onFinish(values); await onFinish(values).finally(() => {
setLoading(false); setLoading(false);
return !!result; });
}} }}
modalProps={{ modalProps={{
destroyOnClose: true, destroyOnClose: true,

View File

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

View File

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