-
Notifications
You must be signed in to change notification settings - Fork 86
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
base: staging
Are you sure you want to change the base?
Feat/strapi banner #159
Conversation
@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. |
This pull request is being automatically deployed with Vercel (learn more). apeswap-dex – ./🔍 Inspect: https://vercel.com/ape-swap-finance/apeswap-dex/7PziwWX9JF1Ant3jtzE6gFR6CrfQ |
export function useSwapBanner() { | ||
const dispatch = useDispatch<AppDispatch>() | ||
const banner = getBanner(); | ||
banner.then((ban) => { | ||
dispatch(setBanner({ banner: ban })) | ||
}); | ||
} |
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 believe this can be improved to be closer to the use we have on the state manager at the farms frontend:
These are good examples of how we use the state manager to load information brought from an API.
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 | ||
} |
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.
This can probably be improved by refactoring the hook.
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