Right now, the detail page, [id].tsx , that shows when you drill into a preview panel uses data from the originally fetched list of items from the explore page. This would cause problems if you loaded a detail page on its own, without first loading the explore page. Instead, we want the detail page to fetch a single record of data when it loads. The record it fetches should be based on the id in the URL. If we load the page /explore-data/3, we should fetch the occurrence with the id (or key) of 3.
Specifically, what we want to do is replace the function that populates the entity variable with a new fetch request to the /occurrence/{gbifId} endpoint of the API. Here's an example of that endpoint for key=4514082304:
Right now, the detail page,
[id].tsx
, that shows when you drill into a preview panel uses data from the originally fetched list of items from the explore page. This would cause problems if you loaded a detail page on its own, without first loading the explore page. Instead, we want the detail page to fetch a single record of data when it loads. The record it fetches should be based on the id in the URL. If we load the page /explore-data/3, we should fetch the occurrence with the id (orkey
) of 3.Specifically, what we want to do is replace the function that populates the
entity
variable with a new fetch request to the /occurrence/{gbifId} endpoint of the API. Here's an example of that endpoint forkey=4514082304
:https://api.gbif.org/v1/occurrence/4514082304