Created
September 1, 2023 12:12
-
-
Save osahyoun/4ff10fcf5f8bbc7a9e0bc60a24f18f54 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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