diff --git a/src/ViewJobDetails.css b/src/ViewJobDetails.css index 23ee85d..2bf8fe8 100644 --- a/src/ViewJobDetails.css +++ b/src/ViewJobDetails.css @@ -91,4 +91,24 @@ body { } + /* Styles for the ads section */ +.ads-section { + background-color: #f9f9f9; + padding: 20px; + border-radius: 5px; + margin-top: 20px; + } + + .ad-job { + margin-bottom: 15px; + } + + .ad-job-title { + font-weight: bold; + text-decoration: none; + } + + .ad-job-location { + color: #777; + } \ No newline at end of file diff --git a/src/ViewJobDetails.js b/src/ViewJobDetails.js index 235040e..3ac1ef5 100644 --- a/src/ViewJobDetails.js +++ b/src/ViewJobDetails.js @@ -5,6 +5,7 @@ import './ViewJobDetails.css'; const ViewJobDetails = () => { const { jobId } = useParams(); const [jobDetails, setJobDetails] = useState(null); + const [otherJobs, setOtherJobs] = useState([]); useEffect(() => { fetch(`https://demo.jobsoid.com/api/v1/jobs/${jobId}`) @@ -15,7 +16,16 @@ const ViewJobDetails = () => { .catch(error => { console.error('Error fetching job details:', error); }); - }, [jobId]); + // Fetch other jobs for ads + fetch('https://demo.jobsoid.com/api/v1/jobs') + .then(response => response.json()) + .then(data => { + setOtherJobs(data); + }) + .catch(error => { + console.error('Error fetching other jobs:', error); + }); + }, [jobId]); if (!jobDetails) { return
Loading...
; @@ -63,6 +73,25 @@ const ViewJobDetails = () => { + {/* Ads Section */} ++ + {adJob.location && adJob.location.city},{' '} + {adJob.location && adJob.location.state} +
+