mango-v4-ui/pages/token/[token].tsx

42 lines
967 B
TypeScript
Raw Normal View History

2022-12-06 16:22:32 -08:00
import TokenPage from '@components/token/TokenPage'
2022-12-11 02:08:50 -08:00
import { CLUSTER } from '@store/mangoStore'
2022-10-23 20:34:47 -07:00
import type { NextPage } from 'next'
2022-10-11 04:59:01 -07:00
import { serverSideTranslations } from 'next-i18next/serverSideTranslations'
export async function getStaticProps({ locale }: { locale: string }) {
return {
props: {
2022-12-16 03:26:42 -08:00
...(await serverSideTranslations(locale, [
'common',
'profile',
'settings',
'token',
])),
2022-10-11 04:59:01 -07:00
},
}
}
2022-10-23 20:34:47 -07:00
export const getStaticPaths = async () => {
2022-12-11 02:08:50 -08:00
const url =
CLUSTER === 'devnet'
? 'https://api.jup.ag/api/tokens/devnet'
: 'https://cache.jup.ag/tokens'
const response = await fetch(url)
const data = await response.json()
const paths = data.map((t: any) => ({
2022-12-27 02:43:36 -08:00
params: { token: t.symbol.toUpperCase() },
2022-10-23 20:34:47 -07:00
}))
return { paths, fallback: false }
2022-10-11 04:59:01 -07:00
}
const Token: NextPage = () => {
return (
<div className="pb-20 md:pb-16">
2022-12-06 16:22:32 -08:00
<TokenPage />
2022-10-11 04:59:01 -07:00
</div>
)
}
export default Token