Closed Joelzor closed 1 year ago
I would suggest you actually send a request for the cohort data, by id.
So that you can then extract the cohort's name, once you fetch it from API.
Finally, the choice of cohort would be better done as a dropdown: you can fetch a list of all cohorts, and display a dropdown with all cohort names. On click of an option, then you assign that option's cohort id as the new cohort for the user.
I would suggest you actually send a request for the cohort data, by id.
Could you clarify this? In the API endpoints, we only have an endpoint for getting all cohorts. I'm not sure how we could get a single cohorts data using a user id
Actually, we forgot to document this endpoint, but you can get a cohort by id: /cohorts/:id
ProfilePage.js
/cohorts/:id
- use cohortId in user data to get the correct cohort - second useEffectProfileEdit.js
/cohorts
endpoint - in a useEffect - we fetch the data as soon as page loads