To install the necessary dependencies, run the following command:
pnpm i
Start the mock API and the development server with these commands:
pnpm mock-api
pnpm dev
In src/Pages/Portfolio/Portfolio.tsx
, the query parameters for the API call are commented out. This is due to the JSON Server not supporting them as expected. Here's how the API hook is structured:
const {
data: prices,
isLoading: isLoadingPrices,
isError: isErrorPrices,
} = useGetAPI<PricesType[]>({
// url: `${ENDPOINTS.prices}?assets=${assetIds}${asOf ? `&asOf=${asOf}` : ''}`,
url: `${ENDPOINTS.prices}`,
options: { enabled: !!assetIds },
})
To use query parameters with your endpoints in a real environment, you might want to uncomment and adjust the URL structure accordingly.
To switch from mock endpoints to real ones, update the endpoint URLs in src/api/const.ts
.
For a visual guide on how the application should look and operate, refer to the screenshot available in the repository: