[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";
|
import SkeletonLayout from "./skeleton";
|
||||||
|
|
||||||
// Utils
|
// Utils
|
||||||
|
import PropTypes from "prop-types";
|
||||||
import { useTheme } from "@emotion/react";
|
import { useTheme } from "@emotion/react";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
@@ -60,10 +61,9 @@ const parseUrl = (url) => {
|
|||||||
* Create page renders monitor creation or configuration views.
|
* Create page renders monitor creation or configuration views.
|
||||||
* @component
|
* @component
|
||||||
*/
|
*/
|
||||||
const UptimeCreate = ({ clone }) => {
|
const UptimeCreate = ({ isClone = false }) => {
|
||||||
const { monitorId } = useParams();
|
const { monitorId } = useParams();
|
||||||
const isCreate = typeof monitorId === "undefined" || clone === true;
|
const isCreate = typeof monitorId === "undefined" || isClone;
|
||||||
const isClone = clone === true;
|
|
||||||
|
|
||||||
// States
|
// States
|
||||||
const [monitor, setMonitor] = useState({
|
const [monitor, setMonitor] = useState({
|
||||||
@@ -720,4 +720,8 @@ const UptimeCreate = ({ clone }) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
UptimeCreate.propTypes = {
|
||||||
|
isClone: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
export default UptimeCreate;
|
export default UptimeCreate;
|
||||||
@@ -85,7 +85,7 @@ const Routes = () => {
|
|||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/uptime/create/:monitorId"
|
path="/uptime/create/:monitorId"
|
||||||
element={<UptimeCreate clone={true} />}
|
element={<UptimeCreate isClone={true} />}
|
||||||
/>
|
/>
|
||||||
<Route
|
<Route
|
||||||
path="/uptime/:monitorId/"
|
path="/uptime/:monitorId/"
|
||||||
|
|||||||
Reference in new issue
Block a user