Skip to content

Commit

Permalink
Update 01-fetching.mdx - use available endpoint (vercel#69559)
Browse files Browse the repository at this point in the history
### Improving Documentation

Changed example endpoint to available endpoint

Co-authored-by: JJ Kasper <[email protected]>
  • Loading branch information
B33fb0n3 and ijjk authored Sep 16, 2024
1 parent e005cb5 commit 3842680
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -275,14 +275,14 @@ interface Post {
}

async function getPost(id: string) {
let res = await fetch(`https://api.example.com/posts/${id}`)
let res = await fetch(`https://api.vercel.app/blog/${id}`)
let post: Post = await res.json()
if (!post) notFound()
return post
}

export async function generateStaticParams() {
let posts = await fetch('https://api.example.com/posts').then((res) =>
let posts = await fetch('https://api.vercel.app/blog').then((res) =>
res.json()
)

Expand Down Expand Up @@ -315,14 +315,14 @@ export default async function Page({ params }: { params: { id: string } }) {
import { notFound } from 'next/navigation'

async function getPost(id) {
let res = await fetch(`https://api.example.com/posts/${id}`)
let res = await fetch(`https://api.vercel.app/blog/${id}`)
let post = await res.json()
if (!post) notFound()
return post
}

export async function generateStaticParams() {
let posts = await fetch('https://api.example.com/posts').then((res) =>
let posts = await fetch('https://api.vercel.app/blog').then((res) =>
res.json()
)

Expand Down

0 comments on commit 3842680

Please sign in to comment.