Skip to content

Commit

Permalink
[B] Adjust html error warning conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
1aurend committed Nov 2, 2023
1 parent f6f3291 commit 9232500
Showing 1 changed file with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export default function Editor({
setHasErrors(false);
return setWarnErrors(false);
}
setWarnErrors("switch");
setHasErrors(true);
};

const htmlProps = {
Expand Down Expand Up @@ -165,14 +165,17 @@ export default function Editor({
setDarkMode(val);
};

/* eslint-disable no-nested-ternary */
const errors = warnErrors
? [
{
source: { pointer: "/data/attributes/body" },
detail: t(`errors.invalid_html_${warnErrors}`)
}
]
: hasErrors;
? Array.isArray(hasErrors)
? hasErrors
: [
{
source: { pointer: "/data/attributes/body" },
detail: t(`errors.invalid_html_${warnErrors}`)
}
]
: [];

return (
<>
Expand Down

0 comments on commit 9232500

Please sign in to comment.