mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 14:10:22 +00:00
perf: use static page generation
This commit is contained in:
parent
816084af3f
commit
21dabec830
@ -65,12 +65,12 @@ const Index: NextPage<IndexProps> = ({ votes, newBots, trusted }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps = async () => {
|
||||
export const getStaticProps = async () => {
|
||||
const votes = await Query.get.list.votes.load(1)
|
||||
const newBots = await Query.get.list.new.load(1)
|
||||
const trusted = await Query.get.list.trusted.load(1)
|
||||
|
||||
return { props: { votes, newBots, trusted } }
|
||||
return { props: { votes, newBots, trusted }, revalidate: 60 }
|
||||
}
|
||||
|
||||
interface IndexProps {
|
||||
|
||||
@ -49,11 +49,11 @@ const Index: NextPage<IndexProps> = ({ bots, servers }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps = async () => {
|
||||
export const getStaticProps = async () => {
|
||||
const bots = await Query.get.list.votes.load(1)
|
||||
const servers = await Query.get.serverList.votes.load(1)
|
||||
|
||||
return { props: { bots, servers } }
|
||||
return { props: { bots, servers }, revalidate: 60 }
|
||||
}
|
||||
|
||||
interface IndexProps {
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { GetServerSideProps, NextPage } from 'next'
|
||||
import { GetStaticProps, NextPage } from 'next'
|
||||
import dynamic from 'next/dynamic'
|
||||
|
||||
import { User } from '@types'
|
||||
@ -87,11 +87,12 @@ const Security: NextPage<SecurityProps> = ({ bugReports }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps<SecurityProps> = async () => {
|
||||
export const getStaticProps: GetStaticProps<SecurityProps> = async () => {
|
||||
return {
|
||||
props: {
|
||||
bugReports: await Promise.all(BUG_REPORTERS.map((u) => get.user.load(u))),
|
||||
},
|
||||
revalidate: 60,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -47,11 +47,11 @@ const ServerIndex: NextPage<ServerIndexProps> = ({ votes, trusted }) => {
|
||||
)
|
||||
}
|
||||
|
||||
export const getServerSideProps = async () => {
|
||||
export const getStaticProps = async () => {
|
||||
const votes = await Query.get.serverList.votes.load(1)
|
||||
const trusted = await Query.get.serverList.trusted.load(1)
|
||||
|
||||
return { props: { votes, trusted } }
|
||||
return { props: { votes, trusted }, revalidate: 60 }
|
||||
}
|
||||
|
||||
interface ServerIndexProps {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user