Conversation
|
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/oceanprotocol/market/BRHxG4N4BEcNrzaP9YSaxYsLGfm8 |
|
|
||
| import styles from './index.module.css' | ||
| import moment from 'moment' | ||
| import fetch from 'cross-fetch' |
There was a problem hiding this comment.
for all fetching either use axios or even way better use the useSWR() hook https://swr.vercel.app
There was a problem hiding this comment.
I thought we were going to use cross-fetch. I can easily switch to useSWR if needed
There was a problem hiding this comment.
that is only over on ocean.js. All fetching code in market uses axios, and when using useSWR hook it should use axios too. See the PricesProvider https://github.com/oceanprotocol/market/blob/main/src/providers/Prices.tsx#L46-L50
Where you can then as seen there use the same fetchData() utility method https://github.com/oceanprotocol/market/blob/main/src/utils/index.ts#L43-L55
There was a problem hiding this comment.
cross-fetch can be used with useSWR, check the graph sync pr. axios has CORS issues when accessing other endpoints. Not sure why stick with it. We already have cross-fetch included for apollo
There was a problem hiding this comment.
In that case, it might be better if we update the fetchData function to use cross-fetch instead of axios.
|
Let's revisit after the v4 split as we ant to sprinkle various statistics throughout the whole interface, not just footer |
Fixes #355 .
Changes proposed in this PR:
/statsThis PR is in some way related to the
market-statsPR #4 since the requests are directed to the API endpoints provided bymarket-stats