Skip to content

Commit

Permalink
Add middleware_address validity check (#4896)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashesh3 authored Feb 27, 2023
1 parent db2ade8 commit 39000ec
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/Components/Facility/UpdateFacilityMiddleware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,24 @@ export const UpdateFacilityMiddleware = (props: any) => {
const handleSubmit = async (e: any) => {
e.preventDefault();
setIsLoading(true);
if (!state.form.middleware_address) {
Notification.Error({
msg: "Middleware Address is required",
});
setIsLoading(false);
return;
}
if (
state.form.middleware_address.match(
/^(?!https?:\/\/)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)*\.[a-zA-Z]{2,}$/
) === null
) {
Notification.Error({
msg: "Invalid Middleware Address",
});
setIsLoading(false);
return;
}
const data: any = {
...state.form,
middleware_address: state.form.middleware_address,
Expand Down

0 comments on commit 39000ec

Please sign in to comment.