mirror of
https://github.com/dsoaress/link-free.git
synced 2026-08-18 15:36:03 +01:00
feat: test ISR
This commit is contained in:
@@ -2,7 +2,6 @@ import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import nc from 'next-connect'
|
||||
|
||||
import { prisma } from '../../services/prisma'
|
||||
const { RAILWAY_TOKEN } = process.env
|
||||
|
||||
const handler = nc<NextApiRequest, NextApiResponse>()
|
||||
.get(async (_req, res) => {
|
||||
@@ -24,10 +23,6 @@ const handler = nc<NextApiRequest, NextApiResponse>()
|
||||
data: { data: JSON.stringify(req.body.data) }
|
||||
})
|
||||
|
||||
if (RAILWAY_TOKEN) {
|
||||
console.log('railway token', RAILWAY_TOKEN)
|
||||
}
|
||||
|
||||
res.status(200).json(response)
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
|
||||
@@ -1,5 +1,21 @@
|
||||
import { Dash } from '../components/Dash'
|
||||
import { GetServerSideProps } from 'next'
|
||||
|
||||
export default function DashPage() {
|
||||
return <Dash />
|
||||
import { Dash } from '../components/Dash'
|
||||
import { fetchData } from '../services/fetchData'
|
||||
import type { Data } from '../types/Data'
|
||||
|
||||
type DashPageProps = {
|
||||
initialData: Data
|
||||
}
|
||||
|
||||
export default function DashPage({ initialData }: DashPageProps) {
|
||||
return <Dash initialData={initialData} />
|
||||
}
|
||||
|
||||
export const getServerSideProps: GetServerSideProps = async () => {
|
||||
const initialData = await fetchData()
|
||||
|
||||
return {
|
||||
props: { initialData }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,24 @@
|
||||
import { Home } from '../components/Home'
|
||||
import { GetStaticProps } from 'next'
|
||||
|
||||
export default function HomePage() {
|
||||
import { Home } from '../components/Home'
|
||||
import { useFetchData } from '../hooks/useFetchData'
|
||||
import { fetchData } from '../services/fetchData'
|
||||
import type { Data } from '../types/Data'
|
||||
|
||||
type HomePageProps = {
|
||||
data: Data
|
||||
}
|
||||
|
||||
export default function HomePage({ data }: HomePageProps) {
|
||||
useFetchData(data)
|
||||
return <Home />
|
||||
}
|
||||
|
||||
export const getStaticProps: GetStaticProps = async () => {
|
||||
const data = await fetchData()
|
||||
|
||||
return {
|
||||
props: { data },
|
||||
revalidate: 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user