mirror of
https://github.com/koreanbots/core.git
synced 2025-12-15 06:10:22 +00:00
fix: build crashes upon rendering static pages
This commit is contained in:
parent
831b025d76
commit
dae36ebd0b
@ -4,6 +4,7 @@ import dynamic from 'next/dynamic'
|
||||
import { Bot, List } from '@types'
|
||||
import * as Query from '@utils/Query'
|
||||
import LongButton from '@components/LongButton'
|
||||
import { PHASE_PRODUCTION_BUILD } from 'next/constants'
|
||||
|
||||
const Advertisement = dynamic(() => import('@components/Advertisement'))
|
||||
const ResponsiveGrid = dynamic(() => import('@components/ResponsiveGrid'))
|
||||
@ -66,6 +67,21 @@ const Index: NextPage<IndexProps> = ({ votes, newBots, trusted }) => {
|
||||
}
|
||||
|
||||
export const getStaticProps = async () => {
|
||||
if (process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD) {
|
||||
const list = {
|
||||
totalPage: 1,
|
||||
currentPage: 1,
|
||||
data: [],
|
||||
}
|
||||
return {
|
||||
props: {
|
||||
votes: list,
|
||||
newBots: list,
|
||||
trusted: list,
|
||||
},
|
||||
revalidate: 1,
|
||||
}
|
||||
}
|
||||
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)
|
||||
|
||||
@ -3,6 +3,7 @@ import dynamic from 'next/dynamic'
|
||||
|
||||
import { Bot, List, Server } from '@types'
|
||||
import * as Query from '@utils/Query'
|
||||
import { PHASE_PRODUCTION_BUILD } from 'next/constants'
|
||||
|
||||
const Advertisement = dynamic(() => import('@components/Advertisement'))
|
||||
const ResponsiveGrid = dynamic(() => import('@components/ResponsiveGrid'))
|
||||
@ -50,6 +51,20 @@ const Index: NextPage<IndexProps> = ({ bots, servers }) => {
|
||||
}
|
||||
|
||||
export const getStaticProps = async () => {
|
||||
if (process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD) {
|
||||
const list = {
|
||||
totalPage: 1,
|
||||
currentPage: 1,
|
||||
data: [],
|
||||
}
|
||||
return {
|
||||
props: {
|
||||
bots: list,
|
||||
servers: list,
|
||||
},
|
||||
revalidate: 1,
|
||||
}
|
||||
}
|
||||
const bots = await Query.get.list.votes.load(1)
|
||||
const servers = await Query.get.serverList.votes.load(1)
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import dynamic from 'next/dynamic'
|
||||
import { User } from '@types'
|
||||
import { BUG_REPORTERS, BUG_REPORT_GROUPS } from '@utils/Constants'
|
||||
import { get } from '@utils/Query'
|
||||
import { PHASE_PRODUCTION_BUILD } from 'next/constants'
|
||||
|
||||
const Docs = dynamic(() => import('@components/Docs'))
|
||||
const DiscordAvatar = dynamic(() => import('@components/DiscordAvatar'))
|
||||
@ -88,6 +89,14 @@ const Security: NextPage<SecurityProps> = ({ bugReports }) => {
|
||||
}
|
||||
|
||||
export const getStaticProps: GetStaticProps<SecurityProps> = async () => {
|
||||
if (process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD) {
|
||||
return {
|
||||
props: {
|
||||
bugReports: [],
|
||||
},
|
||||
revalidate: 1,
|
||||
}
|
||||
}
|
||||
return {
|
||||
props: {
|
||||
bugReports: await Promise.all(BUG_REPORTERS.map((u) => get.user.load(u))),
|
||||
|
||||
@ -3,6 +3,7 @@ import dynamic from 'next/dynamic'
|
||||
|
||||
import { Server, List } from '@types'
|
||||
import * as Query from '@utils/Query'
|
||||
import { PHASE_PRODUCTION_BUILD } from 'next/constants'
|
||||
|
||||
const Advertisement = dynamic(() => import('@components/Advertisement'))
|
||||
const ResponsiveGrid = dynamic(() => import('@components/ResponsiveGrid'))
|
||||
@ -48,6 +49,20 @@ const ServerIndex: NextPage<ServerIndexProps> = ({ votes, trusted }) => {
|
||||
}
|
||||
|
||||
export const getStaticProps = async () => {
|
||||
if (process.env.NEXT_PHASE === PHASE_PRODUCTION_BUILD) {
|
||||
const list = {
|
||||
totalPage: 1,
|
||||
currentPage: 1,
|
||||
data: [],
|
||||
}
|
||||
return {
|
||||
props: {
|
||||
votes: list,
|
||||
trusted: list,
|
||||
},
|
||||
revalidate: 1,
|
||||
}
|
||||
}
|
||||
const votes = await Query.get.serverList.votes.load(1)
|
||||
const trusted = await Query.get.serverList.trusted.load(1)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user