[Uptime]: Added PropType validation, passed isClone directly as prop
This commit is contained in:
1 parent
6cfa77a335
commit
1aedf21566
2 files changed
+8
-4
No files matched your search
@@ -22,6 +22,7 @@ import PulseDot from "../../../Components/Animated/PulseDot";
|
||||
import SkeletonLayout from "./skeleton";
|
||||
|
||||
// Utils
|
||||
import PropTypes from "prop-types";
|
||||
import { useTheme } from "@emotion/react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useTranslation } from "react-i18next";
|
||||
@@ -60,10 +61,9 @@ const parseUrl = (url) => {
|
||||
* Create page renders monitor creation or configuration views.
|
||||
* @component
|
||||
*/
|
||||
const UptimeCreate = ({ clone }) => {
|
||||
const UptimeCreate = ({ isClone = false }) => {
|
||||
const { monitorId } = useParams();
|
||||
const isCreate = typeof monitorId === "undefined" || clone === true;
|
||||
const isClone = clone === true;
|
||||
const isCreate = typeof monitorId === "undefined" || isClone;
|
||||
|
||||
// States
|
||||
const [monitor, setMonitor] = useState({
|
||||
@@ -720,4 +720,8 @@ const UptimeCreate = ({ clone }) => {
|
||||
);
|
||||
};
|
||||
|
||||
UptimeCreate.propTypes = {
|
||||
isClone: PropTypes.bool,
|
||||
};
|
||||
|
||||
export default UptimeCreate;
|
||||
@@ -85,7 +85,7 @@ const Routes = () => {
|
||||
/>
|
||||
<Route
|
||||
path="/uptime/create/:monitorId"
|
||||
element={<UptimeCreate clone={true} />}
|
||||
element={<UptimeCreate isClone={true} />}
|
||||
/>
|
||||
<Route
|
||||
path="/uptime/:monitorId/"
|
||||
|
||||
Reference in new issue
Block a user