fix error message when saving
This commit is contained in:
parent
368643b7f5
commit
2ae5e5e90b
|
|
@ -192,12 +192,7 @@ ${
|
|||
|
||||
call_prasi_events("form", "after_save", [fm, data]);
|
||||
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
result = false;
|
||||
}
|
||||
|
||||
${
|
||||
${
|
||||
is_md &&
|
||||
`\
|
||||
if (typeof md !== "undefined") {
|
||||
|
|
@ -211,8 +206,11 @@ ${
|
|||
md.render();
|
||||
}, 500);
|
||||
}`
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
result = false;
|
||||
}
|
||||
|
||||
return result;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -126,16 +126,26 @@ export const formInit = (fm: FMLocal, props: FMProps) => {
|
|||
|
||||
toast.dismiss();
|
||||
done_all(success);
|
||||
|
||||
if (!success) {
|
||||
fm.status = "ready";
|
||||
fm.render();
|
||||
}
|
||||
|
||||
if (fm.props.sonar === "on" && !isEditor) {
|
||||
setTimeout(() => {
|
||||
toast.dismiss();
|
||||
|
||||
if (!success) {
|
||||
const count = Object.keys(fm.error.list).length;
|
||||
toast.error(
|
||||
<div className="c-flex c-text-red-600 c-items-center">
|
||||
<AlertTriangle className="c-h-4 c-w-4 c-mr-1" />
|
||||
Save Failed, please correct{" "}
|
||||
{Object.keys(fm.error.list).length} errors.
|
||||
Save Failed
|
||||
{count > 0 &&
|
||||
`, please correct
|
||||
${count} errors`}
|
||||
.
|
||||
</div>,
|
||||
{
|
||||
dismissible: true,
|
||||
|
|
|
|||
Loading…
Reference in New Issue