AlexsLemonade / refinebio-web

Refinebio Web
https://staging.web.refine.bio
BSD 3-Clause "New" or "Revised" License
1 stars 0 forks source link

Define methods to format the API response in useDatasetAction #210

Closed nozomione closed 1 year ago

nozomione commented 1 year ago

Context

Reference: https://github.com/AlexsLemonade/refinebio-web/pull/192#discussion_r1350710760

We currently format the API response to a specific data structure before passing it to the DatasetActionButton component for the useDatasetAction hook. We'll instead create a new helper method in the useDatasetAction hook which formats the API response, and then use that to pass the formatted data to the DatasetActionButton component.

The data structure is as follows:

{ experimentAccessionCode: { all: true, total: num_downloadable_samples }}

Problem or idea

We should define the methods to format the API response (for a single experiment and an array of experiments) in the useDatasetActionhook and use it to pass the prop to the DatasetActionButton component.

Solution or next step

Implement the above and adjust the codebase accordingly.