handled console error
This commit is contained in:
parent
e0994c6f43
commit
f3bedf5826
@ -62,7 +62,7 @@ const AttendancePage = () => {
|
||||
modalElement.classList.remove("show");
|
||||
modalElement.style.display = "none";
|
||||
document.body.classList.remove("modal-open");
|
||||
document.querySelector(".modal-backdrop").remove();
|
||||
document.querySelector(".modal-backdrop")?.remove();
|
||||
}
|
||||
};
|
||||
|
||||
@ -108,7 +108,7 @@ const AttendancePage = () => {
|
||||
className="modal fade show"
|
||||
style={{ display: "block" }}
|
||||
id="check-Out-modal"
|
||||
tabindex="-1"
|
||||
tabIndex="-1"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<AttendanceModel
|
||||
|
@ -9,6 +9,7 @@ import { useProfile } from "../../hooks/useProfile";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import { useProjectDetails, useProjects } from "../../hooks/useProjects";
|
||||
import { setProjectId } from "../../slices/localVariablesSlice";
|
||||
import showToast from "../../services/toastService";
|
||||
|
||||
const TaskPlannng = () => {
|
||||
const { profile } = useProfile();
|
||||
@ -22,6 +23,7 @@ const TaskPlannng = () => {
|
||||
(store) => store.localVariables.projectId
|
||||
);
|
||||
|
||||
|
||||
const [project, setProject] = useState(null);
|
||||
const [projectDetails, setProjectDetails] = useState(null);
|
||||
const [activities, setActivities] = useState(null);
|
||||
@ -66,14 +68,22 @@ const TaskPlannng = () => {
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error(error);
|
||||
setError("Failed to fetch data.");
|
||||
const message =
|
||||
error.response?.data?.message ||
|
||||
error.message ||
|
||||
"An unexpected error occurred";
|
||||
showToast( message, "error" );
|
||||
});
|
||||
} else {
|
||||
setProjectDetails(project_cache);
|
||||
}
|
||||
} catch (err) {
|
||||
setError("Failed to fetch data.");
|
||||
setError( "Failed to fetch data." );
|
||||
const message =
|
||||
error.response?.data?.message ||
|
||||
error.message ||
|
||||
"An unexpected error occurred";
|
||||
showToast( message, "error" );
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user