fix: loading did not disappear after submission failure (#2252)
This commit is contained in:
parent
4812cc5692
commit
1d942d9910
@ -332,14 +332,18 @@ export const useCreateAction = () => {
|
|||||||
const { resource } = useResourceContext();
|
const { resource } = useResourceContext();
|
||||||
return {
|
return {
|
||||||
async run() {
|
async run() {
|
||||||
await form.submit();
|
try {
|
||||||
field.data = field.data || {};
|
await form.submit();
|
||||||
field.data.loading = true;
|
field.data = field.data || {};
|
||||||
await resource.create({ values: form.values });
|
field.data.loading = true;
|
||||||
ctx.setVisible(false);
|
await resource.create({ values: form.values });
|
||||||
await form.reset();
|
ctx.setVisible(false);
|
||||||
field.data.loading = false;
|
await form.reset();
|
||||||
refresh();
|
field.data.loading = false;
|
||||||
|
refresh();
|
||||||
|
} catch (error) {
|
||||||
|
field.data.loading=false;
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user