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

Feat/strapi banner #159

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from

Conversation

ixm-759
Copy link
Collaborator

@ixm-759 ixm-759 commented Jun 10, 2021

PLEASE DO NOT SUBMIT TOKEN LISTING PULL REQUESTS

All listing requests should be made with this issue template.

Each listing request made as a pull request instead of an issues with the proper template will be ignored and closed.


[ ] Before opening a pull request, please read the contributing guidelines first
[ ] If your PR is work in progress, open it as draft
[ ] Before requesting a review, all the checks need to pass
[ ] Explain what your PR does

@vercel
Copy link

vercel bot commented Jun 10, 2021

@ixm-759 is attempting to deploy a commit to the ape-swap-finance Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Jun 14, 2021

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

apeswap-dex – ./

🔍 Inspect: https://vercel.com/ape-swap-finance/apeswap-dex/7PziwWX9JF1Ant3jtzE6gFR6CrfQ
✅ Preview: Failed

Comment on lines +21 to +27
export function useSwapBanner() {
const dispatch = useDispatch<AppDispatch>()
const banner = getBanner();
banner.then((ban) => {
dispatch(setBanner({ banner: ban }))
});
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this can be improved to be closer to the use we have on the state manager at the farms frontend:

https://github.com/ApeSwapFinance/apeswap-frontend/blob/staging/src/views/Lottery/hooks/useGetRecentLotteryRoundData.ts#L12

https://github.com/ApeSwapFinance/apeswap-frontend/blob/staging/src/state/strapi/useFetchPromoHome.ts#L10

These are good examples of how we use the state manager to load information brought from an API.

Comment on lines +11 to +26
let bannerPromise

export const fetchBanner = async () => {
const url = `${baseUrlStrapi}/dexes`
const resp = await fetch(url)
const data = await resp.json()
const poolsList: Banner = data.length > 0 ? data[0] : null

return poolsList
}

export const getBanner = async () => {
if (!bannerPromise) bannerPromise = fetchBanner()

return bannerPromise
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can probably be improved by refactoring the hook.

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.

2 participants