Skip to content

Commit 016ddc0

Browse files
Merge pull request #4034 from OneCommunityGlobal/veda-applicant-volunteer-ratio-css-changes
Veda Charitha - Applicant Volunteer Ratio CSS Changes
2 parents 2c70746 + 471831b commit 016ddc0

1 file changed

Lines changed: 2 additions & 9 deletions

File tree

src/components/ApplicantVolunteerRatio/ApplicantVolunteerRatio.jsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,15 @@ function ApplicantVolunteerRatio() {
2525
const fetchAllRoles = async () => {
2626
try {
2727
const response = await getAllApplicantVolunteerRatios({});
28-
const apiData = response.data;
29-
28+
const apiData = response?.data ?? [];
3029
const uniqueRoles = [...new Set(apiData.map(item => item.role))];
3130
const roleOptions = uniqueRoles.map(role => ({ label: role, value: role }));
32-
3331
setAllRoles(roleOptions);
3432
setSelectedRoles(roleOptions);
3533
} catch (err) {
3634
setError('Failed to load roles. Please try again.');
3735
}
3836
};
39-
4037
fetchAllRoles();
4138
}, []);
4239

@@ -56,10 +53,8 @@ function ApplicantVolunteerRatio() {
5653
setData([]);
5754
return;
5855
}
59-
6056
try {
6157
setLoading(true);
62-
6358
const filters = {};
6459
if (startDate) filters.startDate = startDate.toISOString().split('T')[0];
6560
if (endDate) filters.endDate = endDate.toISOString().split('T')[0];
@@ -68,8 +63,7 @@ function ApplicantVolunteerRatio() {
6863
}
6964

7065
const response = await getAllApplicantVolunteerRatios(filters);
71-
const apiData = response.data;
72-
66+
const apiData = response?.data ?? [];
7367
const transformedData = apiData.map(item => ({
7468
role: item.role,
7569
applicants: item.totalApplicants,
@@ -83,7 +77,6 @@ function ApplicantVolunteerRatio() {
8377
setLoading(false);
8478
}
8579
};
86-
8780
fetchFilteredData();
8881
}, [startDate, endDate, selectedRoles]);
8982

0 commit comments

Comments
 (0)