Skip to content
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

Closed
wants to merge 4 commits into from
Closed

Add stats page #471

wants to merge 4 commits into from

Conversation

DimitarSD
Copy link

@DimitarSD DimitarSD commented Apr 1, 2021

Fixes #355 .

Changes proposed in this PR:

  • Adds a new stats page available at /stats

This PR is in some way related to the market-stats PR #4 since the requests are directed to the API endpoints provided by market-stats

@vercel
Copy link

vercel bot commented Apr 1, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/oceanprotocol/market/BRHxG4N4BEcNrzaP9YSaxYsLGfm8
✅ Preview: https://market-git-feature-public-analytics-oceanprotocol.vercel.app


import styles from './index.module.css'
import moment from 'moment'
import fetch from 'cross-fetch'
Copy link
Contributor

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

Copy link
Author

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

Copy link
Contributor

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

Copy link
Contributor

@mihaisc mihaisc Apr 7, 2021

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

Copy link
Author

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.

@kremalicious
Copy link
Contributor

Let's revisit after the v4 split as we ant to sprinkle various statistics throughout the whole interface, not just footer

@kremalicious kremalicious deleted the feature/public-analytics branch May 25, 2022 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

public analytics
3 participants