//import React from "react";
import React, { useContext,useState, useEffect } from "react";
// import MyTasks from "../components/MyTasks";
// import UsersService from "../services/UsersService";
import usersService from "../services/UsersService";
import MyJobs from "../components/MyJobs";
import { useSelector } from "react-redux";

export default function MyJobsPage() {

    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 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} />
        </>
    );
}
