Skip to content

Instantly share code, notes, and snippets.

@osahyoun
Created September 1, 2023 12:12
Show Gist options
  • Select an option

  • Save osahyoun/4ff10fcf5f8bbc7a9e0bc60a24f18f54 to your computer and use it in GitHub Desktop.

Select an option

Save osahyoun/4ff10fcf5f8bbc7a9e0bc60a24f18f54 to your computer and use it in GitHub Desktop.
import { redirect } from 'next/navigation'
async function fetchPage(slug) {
const res = await fetch('https://...')
if (!res.ok) return undefined
return res.json()
}
export default async function CampaignPage({ slug }) {
const page = await fetchPage(slug)
if (!page) {
redirect('...')
}
return(
<>
<CampaignImage />
<CampaignTitle />
<BodyContent />
<Thermometer />
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment