remove pages/monitors/index.js

This commit is contained in:
Ananya Verma committed 2024-08-31 00:53:49 +05:30
1 parent 2b425a27cf
commit 20868135c1
2 files changed
+6 -8

No files matched your search

+1 -5
View File
@@ -56,11 +56,7 @@ function App() {
element={<ProtectedRoute Component={MonitorsWithAdminProp} />}
/>
<Route
path="/monitors/create"
element={<ProtectedRoute Component={CreateMonitor} />}
/>
<Route
path="/monitors/clone/:monitorId"
path="/monitors/create/:monitorId?"
element={<ProtectedRoute Component={CreateMonitor} />}
/>
<Route
@@ -48,10 +48,12 @@ const CreateMonitor = () => {
const data = monitors.find((monitor) => monitor._id === monitorId);
if (!data) {
console.error("Error fetching monitor of id: " + monitorId);
navigate("/not-found");
navigate("/not-found", {replace: true});
}
const {url, name, ...rest} = data;
rest.interval = rest.interval/60000;
const {name, ...rest} = data; //data.name is read-only
if(rest.type == 'http') rest.url = rest.url.substring(8, rest.url.length)
rest.name = `${name} (Clone)`;
rest.interval /= 60000;
setMonitor({
...rest,
});