allow editing in create component
This commit is contained in:
1 parent
b99bb99e2a
commit
61e319ef44
1 file changed
+4
-1
@@ -18,6 +18,7 @@ import { useNavigate } from "react-router-dom";
|
|||||||
import { useSelector, useDispatch } from "react-redux";
|
import { useSelector, useDispatch } from "react-redux";
|
||||||
import { monitorValidation } from "../../../Validation/validation";
|
import { monitorValidation } from "../../../Validation/validation";
|
||||||
import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
|
import { createUptimeMonitor } from "../../../Features/UptimeMonitors/uptimeMonitorsSlice";
|
||||||
|
import { useLocation } from "react-router-dom";
|
||||||
|
|
||||||
// Constants
|
// Constants
|
||||||
const BREADCRUMBS = [
|
const BREADCRUMBS = [
|
||||||
@@ -34,6 +35,9 @@ const SELECT_VALUES = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
const CreateDistributedUptime = () => {
|
const CreateDistributedUptime = () => {
|
||||||
|
const location = useLocation();
|
||||||
|
const isCreate = location.pathname.startsWith("/distributed-uptime/create");
|
||||||
|
|
||||||
// Redux state
|
// Redux state
|
||||||
const { user, authToken } = useSelector((state) => state.auth);
|
const { user, authToken } = useSelector((state) => state.auth);
|
||||||
const isLoading = useSelector((state) => state.uptimeMonitors.isLoading);
|
const isLoading = useSelector((state) => state.uptimeMonitors.isLoading);
|
||||||
@@ -103,7 +107,6 @@ const CreateDistributedUptime = () => {
|
|||||||
{ [name]: value },
|
{ [name]: value },
|
||||||
{ abortEarly: false }
|
{ abortEarly: false }
|
||||||
);
|
);
|
||||||
console.log(name);
|
|
||||||
setErrors((prev) => ({
|
setErrors((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
...(error ? { [name]: error.details[0].message } : { [name]: undefined }),
|
...(error ? { [name]: error.details[0].message } : { [name]: undefined }),
|
||||||
|
|||||||
Reference in new issue
Block a user