-
Notifications
You must be signed in to change notification settings - Fork 298
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stats page #471
Add stats page #471
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought we were going to use cross-fetch
. I can easily switch to useSWR
if needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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:
/stats
This PR is in some way related to the
market-stats
PR #4 since the requests are directed to the API endpoints provided bymarket-stats