diff --git a/src/pages/employee/EmployeeList.jsx b/src/pages/employee/EmployeeList.jsx index 002c205d..387d6232 100644 --- a/src/pages/employee/EmployeeList.jsx +++ b/src/pages/employee/EmployeeList.jsx @@ -18,7 +18,7 @@ import { VIEW_ALL_EMPLOYEES, VIEW_TEAM_MEMBERS, } from "../../utils/constants"; -import { clearCacheKey, useSelectedproject } from "../../slices/apiDataManager"; +import { clearCacheKey, useSelectedProject } from "../../slices/apiDataManager"; import { useHasUserPermission } from "../../hooks/useHasUserPermission"; import SuspendEmp from "../../components/Employee/SuspendEmp"; // Keep if you use SuspendEmp import { @@ -41,7 +41,7 @@ const EmployeeList = () => { // const selectedProjectId = useSelector( // (store) => store.localVariables.projectId // ); - const selectedProjectId = useSelectedproject(); + const selectedProjectId = useSelectedProject(); const { projectNames, loading: projectLoading, fetchData } = useProjectName(); const dispatch = useDispatch(); @@ -177,10 +177,12 @@ const EmployeeList = () => { useEffect(() => { if (!loading && Array.isArray(employees)) { const sorted = [...employees].sort((a, b) => { - const nameA = `${a.firstName || ""}${a.middleName || ""}${a.lastName || "" - }`.toLowerCase(); - const nameB = `${b.firstName || ""}${b.middleName || ""}${b.lastName || "" - }`.toLowerCase(); + const nameA = `${a.firstName || ""}${a.middleName || ""}${ + a.lastName || "" + }`.toLowerCase(); + const nameB = `${b.firstName || ""}${b.middleName || ""}${ + b.lastName || "" + }`.toLowerCase(); return nameA?.localeCompare(nameB); }); @@ -278,8 +280,9 @@ const EmployeeList = () => { ? "Suspend Employee" : "Reactivate Employee" } - message={`Are you sure you want to ${selectedEmpFordelete?.isActive ? "suspend" : "reactivate" - } this employee?`} + message={`Are you sure you want to ${ + selectedEmpFordelete?.isActive ? "suspend" : "reactivate" + } this employee?`} onSubmit={() => suspendEmployee({ employeeId: selectedEmpFordelete.id, diff --git a/src/slices/apiDataManager.jsx b/src/slices/apiDataManager.jsx index 97f6dcb5..9c3fcc1e 100644 --- a/src/slices/apiDataManager.jsx +++ b/src/slices/apiDataManager.jsx @@ -4,10 +4,9 @@ import { clearApiCacheKey, flushApiCache, } from "../slices/apiCacheSlice"; -import {setLoginUserPermmisions} from "./globalVariablesSlice"; +import { setLoginUserPermmisions } from "./globalVariablesSlice"; import { useSelector } from "react-redux"; - // Cache data export const cacheData = (key, data) => { store.dispatch(cacheApiResponse({ key, data })); @@ -28,9 +27,7 @@ export const clearAllCache = () => { store.dispatch(flushApiCache()); }; - - -export const cacheProfileData = ( data) => { +export const cacheProfileData = (data) => { store.dispatch(setLoginUserPermmisions(data)); }; // Get cached data @@ -39,14 +36,13 @@ export const getCachedProfileData = () => { }; export const useSelectedProject = () => { - const selectedProject = useSelector((store)=> store.localVariables.projectId); + const selectedProject = useSelector( + (store) => store.localVariables.projectId + ); var project = localStorage.getItem("project"); - if(project){ - return project - } else{ - return selectedProject + if (project) { + return project; + } else { + return selectedProject; } - - - -}; \ No newline at end of file +};