From 89b042fc3d9c675d52eddade1039687d51b1fc26 Mon Sep 17 00:00:00 2001 From: Ananya Verma Date: Sat, 31 Aug 2024 01:26:30 +0530 Subject: [PATCH] replace url.parse() with new URL() --- Client/src/Pages/Monitors/CreateMonitor/index.jsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Client/src/Pages/Monitors/CreateMonitor/index.jsx b/Client/src/Pages/Monitors/CreateMonitor/index.jsx index f77ca5478..e2944b659 100644 --- a/Client/src/Pages/Monitors/CreateMonitor/index.jsx +++ b/Client/src/Pages/Monitors/CreateMonitor/index.jsx @@ -51,7 +51,10 @@ const CreateMonitor = () => { navigate("/not-found", {replace: true}); } const {name, ...rest} = data; //data.name is read-only - if(rest.type === 'http') rest.url = URL.parse(rest.url)?.host; + if(rest.type === 'http'){ + const url = new URL(rest.url) + rest.url = url.host + } rest.name = `${name} (Clone)`; rest.interval /= MS_PER_MINUTE; setMonitor({