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