use URL instance to parse host from url

This commit is contained in:
Ananya Verma committed 2024-08-31 00:54:43 +05:30
1 parent 2446b81e79
commit bc9e59315a
1 file changed
+1 -1
@@ -51,7 +51,7 @@ const CreateMonitor = () => {
navigate("/not-found", {replace: true});
}
const {name, ...rest} = data; //data.name is read-only
if(rest.type == 'http') rest.url = rest.url.substring(8, rest.url.length)
if(rest.type === 'http') rest.url = URL.parse(rest.url)?.host;
rest.name = `${name} (Clone)`;
rest.interval /= MS_PER_MINUTE;
setMonitor({