moved user joblist into it's own slice, to avoid unneccessary side menu display recalculation

This commit was merged in pull request #121.
This commit is contained in:
victorAnumudu
2023-05-30 07:29:57 +01:00
parent 577212eb19
commit b2bfa6cd54
7 changed files with 89 additions and 46 deletions
+20 -19
View File
@@ -12,32 +12,33 @@ export default function MyJobsPage() {
return 0;
};
const { jobListTable } = useSelector((state) => state.tableReload);
const {userJobList} = useSelector((state) => state.userJobList)
// const { jobListTable } = useSelector((state) => state.tableReload);
// const userApi = new usersService();
// const activeJobList = userApi.getMyJobList();
const [MyJobList, setMyJobList] = useState({ loading: true, data: [] });
const api = new usersService();
// const [myJobList, setMyJobList] = useState({ loading: true, data: [] });
// const api = new usersService();
const getMyJobList = async () => {
setMyJobList({ loading: true, data: [] });
try {
const res = await api.getMyJobList();
setMyJobList({ loading: false, data: res.data });
// setMyJobList(res.data);
} catch (error) {
setMyJobList({ loading: false, data: [] });
console.log("Error getting mode");
}
};
useEffect(() => {
getMyJobList();
}, [jobListTable]);
// const getMyJobList = async () => {
// setMyJobList({ loading: true, data: [] });
// try {
// const res = await api.getMyJobList();
// setMyJobList({ loading: false, data: res.data });
// // setMyJobList(res.data);
// } catch (error) {
// setMyJobList({ loading: false, data: [] });
// console.log("Error getting mode");
// }
// };
// useEffect(() => {
// getMyJobList();
// }, [jobListTable]);
// debugger;
return (
<>
<MyJobs MyJobList={MyJobList} commonHeadData={commonHeadData} />
<MyJobs MyJobList={userJobList} commonHeadData={commonHeadData} />
</>
);
}