diff --git a/src/components/AddJob/AddJob.jsx b/src/components/AddJob/AddJob.jsx index 6e35d2a..b3a3f0f 100644 --- a/src/components/AddJob/AddJob.jsx +++ b/src/components/AddJob/AddJob.jsx @@ -4,6 +4,8 @@ import InputCom from "../Helpers/Inputs/InputCom"; import LoadingSpinner from "../Spinners/LoadingSpinner"; import usersService from "../../services/UsersService"; +import { useSelector } from "react-redux"; + import { Form, Formik } from "formik"; import * as Yup from "yup"; @@ -31,31 +33,43 @@ const validationSchema = Yup.object().shape({ timeline_days: Yup.number() .typeError("you must specify a number") .min(1, "Price must be greater than 0") - .required("Price is required"), + .required("Timeline is required"), }); -let initialValues = { - // initial values for formik - country: "", - price: 0, - title: "", - description: "", - job_detail: "", - timeline_days: "", -}; +// let initialValues = { +// // initial values for formik +// country: "NG", +// price: 0, +// title: "", +// description: "", +// job_detail: "", +// timeline_days: "", +// }; function AddJob() { const ApiCall = new usersService(); const navigate = useNavigate(); + let {userDetails} = useSelector((state)=> state.userDetails) + let [pageLoading, setPageLoading] = useState(true); // State used for knowing when the page is mounting let [country, setCountry] = useState({ - loading: false, + loading: true, status: false, data: [], }); // To Hold the array of country getUserCountry returns + let initialValues = { + // initial values for formik + country: userDetails.country, + price: "", + title: "", + description: "", + job_detail: "", + timeline_days: "", + }; + let [requestStatus, setRequestStatus] = useState({ loading: false, status: false, @@ -119,8 +133,8 @@ function AddJob() { }; useEffect(() => { - setPageLoading(false); getUserCountry(); + setPageLoading(false); }, []); return pageLoading.loading ? ( @@ -149,16 +163,17 @@ function AddJob() {