mirror of
https://github.com/lbr77/blog-astro.git
synced 2026-04-09 00:19:12 +00:00
1
This commit is contained in:
@@ -239,7 +239,7 @@ export async function fetchRemotePost(
|
|||||||
slug: string,
|
slug: string,
|
||||||
): Promise<NotionPost | null> {
|
): Promise<NotionPost | null> {
|
||||||
try {
|
try {
|
||||||
const res = await fetch(`${POSTS_API_URL}/${slug}`)
|
const res = await fetch(`https://notion-api.nvme0n1p.dev/v2/posts/${slug}`)
|
||||||
if (!res.ok) throw new Error(`Failed to fetch post: ${res.status}`)
|
if (!res.ok) throw new Error(`Failed to fetch post: ${res.status}`)
|
||||||
const data = (await res.json()) as NotionPost
|
const data = (await res.json()) as NotionPost
|
||||||
return data
|
return data
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import { POSTS_API_URL } from '../data-utils'
|
|
||||||
import type { Post } from '../interfaces'
|
import type { Post } from '../interfaces'
|
||||||
|
|
||||||
export async function getPostByPageId(pageId: string): Promise<Post | null> {
|
export async function getPostByPageId(pageId: string): Promise<Post | null> {
|
||||||
if (!pageId) return null
|
if (!pageId) return null
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch(POSTS_API_URL)
|
const res = await fetch("https://notion-api.nvme0n1p.dev/v2/posts")
|
||||||
if (!res.ok) throw new Error(`Failed to fetch posts: ${res.status}`)
|
if (!res.ok) throw new Error(`Failed to fetch posts: ${res.status}`)
|
||||||
|
|
||||||
const payload = (await res.json()) as { posts?: any[] }
|
const payload = (await res.json()) as { posts?: any[] }
|
||||||
|
|||||||
Reference in New Issue
Block a user