I am trying to get all data of the applicants in an array:
Here is following code that how I fetch an array:
const [applicants, setTeamApplications] = useState([]);
const fetchApplicationData = async () => {
const res = await axios.get(`/api/v1/invites/team/applications/${teamId}`);
const items = res.data.map((item) =>
await axios.get(`/api/v1/profiles/profile/${item.applicant_publicId}`)
);
// Set state
setTeamApplications(res.data);
// Toggle loading state
setLoadingState(false);
};
after I console.log(applicants)
it gave me this:
[{…}]
0:
applicant_publicId: "La1618912810062"
application_letter: "apply"
id: 3
response: "Waiting on review"
Now im trying to fetch data again with the applicant_publicId to get more data:
/api/v1/profiles/profile/${index.applicant_publicId}
How can I do that?