Skip to content

Commit dc75541

Browse files
committed
Resolved pipeline safe typescript build error (for loop)
1 parent 4e2d24b commit dc75541

File tree

1 file changed

+10
-16
lines changed
  • DigitalLearningSolutions.Web/Scripts/frameworks

1 file changed

+10
-16
lines changed

DigitalLearningSolutions.Web/Scripts/frameworks/branding.ts

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -72,25 +72,19 @@ if (bfield) wireClearOnInput(bfield);
7272
if (cfield) wireClearOnInput(cfield);
7373
if (tfield) wireClearOnInput(tfield);
7474

75-
7675
form.addEventListener("submit", (e: Event) => {
77-
const fields = [
76+
[
7877
{ el: bfield, msg: "Please enter a valid brand." },
7978
{ el: cfield, msg: "Please enter a valid category." },
8079
{ el: tfield, msg: "Please enter a valid topic." }
81-
];
82-
83-
for (const f of fields) {
84-
if (f.el.required) {
85-
if (!f.el.value.trim()) {
86-
e.preventDefault();
87-
f.el.setCustomValidity(f.msg);
88-
f.el.reportValidity();
89-
f.el.focus();
90-
return;
91-
} else {
92-
f.el.setCustomValidity("");
93-
}
80+
].forEach(f => {
81+
if (f.el.required && !f.el.value.trim()) {
82+
e.preventDefault();
83+
f.el.setCustomValidity(f.msg);
84+
f.el.reportValidity();
85+
f.el.focus();
86+
} else {
87+
f.el.setCustomValidity("");
9488
}
95-
}
89+
});
9690
});

0 commit comments

Comments
 (0)