Skip to content

Commit 6e3c8b8

Browse files
committed
refactor: simplify URL adjustment logic in onChange handler for readability
1 parent 4fec374 commit 6e3c8b8

File tree

1 file changed

+5
-2
lines changed
  • client/src/Pages/Infrastructure/Create

1 file changed

+5
-2
lines changed

client/src/Pages/Infrastructure/Create/index.jsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,8 +262,11 @@ const CreateInfrastructureMonitor = () => {
262262
[name]: value,
263263
});
264264

265-
const adjustedValue =
266-
name === "url" ? (value ? `http${https ? "s" : ""}://${value}` : value) : value;
265+
let adjustedValue = value;
266+
267+
if (name === "url" && value) {
268+
adjustedValue = `http${https ? "s" : ""}://${value}`;
269+
}
267270

268271
const { error } = infrastructureMonitorValidation.validate(
269272
{ [name]: adjustedValue },

0 commit comments

Comments
 (0)