import { NextPage, NextPageContext } from 'next' import dynamic from 'next/dynamic' import { get } from '@utils/Query' import { Bot, List } from '@types' import { ParsedUrlQuery } from 'querystring' import { PageCount } from '@utils/Yup' const Hero = dynamic(() => import('@components/Hero')) const Advertisement = dynamic(() => import('@components/Advertisement')) const BotCard = dynamic(() => import('@components/BotCard')) const Container = dynamic(() => import('@components/Container')) const ResponsiveGrid = dynamic(() => import('@components/ResponsiveGrid')) const Trusted: NextPage = ({ data }) => { return ( <> {data.data.map((bot) => ( ))} {/* */} ) } export const getServerSideProps = async (ctx: Context) => { let data: List if (!ctx.query.page) ctx.query.page = '1' const validate = await PageCount.validate(ctx.query.page) .then((el) => el) .catch(() => null) if (!validate || isNaN(Number(ctx.query.page))) data = null else data = await get.list.trusted.load(Number(ctx.query.page)) return { props: { data, }, } } interface Context extends NextPageContext { query: URLQuery } interface URLQuery extends ParsedUrlQuery { page: string } interface TrustedProps { data: List } export default Trusted