replace url.parse() with new URL()

This commit is contained in:
Ananya Verma committed 2024-08-31 01:26:30 +05:30
1 parent bc9e59315a
commit 89b042fc3d
1 file changed
+4 -1
@@ -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({