Corrected regex to accurately detect / and dashboard

This commit is contained in:
pramod mahajan 2025-07-18 11:19:29 +05:30
parent 1c68e3a3d5
commit d176221c13
3 changed files with 27 additions and 11 deletions

View File

@ -188,7 +188,7 @@ const Attendance = ({ getRole, handleModalData }) => {
</tr>
))}
{!attendance && (
<span>No employees assigned to the project</span>
<span className="text-secondary m-4">No employees assigned to the project!</span>
)}
</tbody>
</table>

View File

@ -8,8 +8,10 @@ import moment from "moment";
import usePagination from "../../hooks/usePagination";
import eventBus from "../../services/eventBus";
import { cacheData, clearCacheKey } from "../../slices/apiDataManager";
import { useQueryClient } from "@tanstack/react-query";
const Regularization = ({ handleRequest }) => {
const queryClient = useQueryClient();
var selectedProject = useSelector((store) => store.localVariables.projectId);
const [regularizesList, setregularizedList] = useState([]);
const { regularizes, loading, error, refetch } =
@ -28,14 +30,25 @@ const Regularization = ({ handleRequest }) => {
const handler = useCallback(
(msg) => {
if (selectedProject == msg.projectId) {
const updatedAttendance = regularizes?.filter(
(item) => item.id !== msg.response.id
);
cacheData("regularizedList", {
data: updatedAttendance,
projectId: selectedProject,
});
refetch();
// const updatedAttendance = regularizes?.filter(
// (item) => item.id !== msg.response.id
// );
// cacheData("regularizedList", {
// data: updatedAttendance,
// projectId: selectedProject,
// });
// refetch();
queryClient.setQueryData(
["regularizedList", selectedProject],
(oldData) => {
if (!oldData) {
queryClient.invalidateQueries({ queryKey: ["regularizedList"] });
}
return oldData.filter((record) => record.id !== msg.response.id);
}
),
queryClient.invalidateQueries({ queryKey: ["attendanceLogs"] });
}
},
[selectedProject, regularizes]
@ -123,7 +136,10 @@ const Regularization = ({ handleRequest }) => {
</tbody>
</table>
) : (
<div className="my-4"> <span className="text-muted">No Requests Found</span></div>
<div className="my-4">
{" "}
<span className="text-secondary">No Requests Found !</span>
</div>
)}
{!loading && totalPages > 1 && (
<nav aria-label="Page ">

View File

@ -29,7 +29,7 @@ const Header = () => {
const HasManageProjectPermission = useHasUserPermission(MANAGE_PROJECT);
const isDirectoryPath = /^\/directory$/.test(location.pathname);
const isDashboard = /^\/dashboard$/.test(location.pathname);
const isDashboard = /^\/dashboard$/.test(location.pathname) || /^\/$/.test(location.pathname);
const getRole = (roles, joRoleId) => {
if (!Array.isArray(roles)) return "User";
let role = roles.find((role) => role.id === joRoleId);