useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch("https://diffblue.pinpointhq.com/jobs.json");
const { data } = await response.json();
setJobs([...data]);
const uniqueDepartments = [
...new Set(
data.map((job: { department: { name: any } }) => job.department.name)
),
];
const uniqueLocations = [
...new Set(
data.map((job: { location: { name: any } }) => job.location.name)
),
];
setDepartments(uniqueDepartments);
setLocation(uniqueLocations);
} catch (error) {
}
};
fetchData();
}, []);