Skip to content

Commit

Permalink
key changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Otonbara committed Nov 18, 2024
1 parent cafe93a commit daa262f
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 10 deletions.
21 changes: 11 additions & 10 deletions skillmatch-frontend/src/pages/JobSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,18 @@ const JobSearch = () => {
const [filteredJobs, setFilteredJobs] = useState([]);

useEffect(() => {
const fetchJobs = async () => {
try {
const response = await axios.get('http://127.0.0.1:8000/api/jobs/list/');
setJobs(response.data);
setFilteredJobs(response.data);
} catch (error) {
console.error('Error fetching jobs:', error);
}
};
// Fake job data for testing
const fakeJobs = [
{ id: 1, title: 'Software Engineer', location: 'New York' },
{ id: 2, title: 'Product Manager', location: 'San Francisco' },
{ id: 3, title: 'Data Scientist', location: 'Remote' },
{ id: 4, title: 'Front-End Developer', location: 'Los Angeles' },
{ id: 5, title: 'Back-End Developer', location: 'Chicago' },
{ id: 6, title: 'UX/UI Designer', location: 'Austin' },
];

fetchJobs();
setJobs(fakeJobs);
setFilteredJobs(fakeJobs); // Initially showing all jobs
}, []);

const handleSearch = ({ title, location }) => {
Expand Down
35 changes: 35 additions & 0 deletions skillmatch-frontend/src/pages/Jobs.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,41 @@ const Jobs = () => {
setJobs(response.data);
} catch (error) {
console.error('Error fetching jobs:', error);
// Add some fake jobs in case the API fails
setJobs([
{
id: 1,
title: "Software Engineer",
company: "Tech Solutions Ltd.",
location: "Remote",
description: "Join our team to build innovative software solutions. 3+ years of experience required.",
posted: "2 days ago"
},
{
id: 2,
title: "Data Scientist",
company: "DataWorks Inc.",
location: "New York, NY",
description: "We are looking for a Data Scientist to analyze data and build predictive models.",
posted: "1 week ago"
},
{
id: 3,
title: "UX Designer",
company: "Creative Studio",
location: "San Francisco, CA",
description: "Seeking a passionate UX Designer to help shape user experiences for our clients.",
posted: "3 days ago"
},
{
id: 4,
title: "Full Stack Developer",
company: "DevTech",
location: "Austin, TX",
description: "We need a skilled Full Stack Developer to join our development team. Must have React and Node.js experience.",
posted: "5 days ago"
}
]);
}
};

Expand Down

0 comments on commit daa262f

Please sign in to comment.