@@ -2,6 +2,7 @@ import * as React from 'react'
22import { NextRequest } from 'next/server'
33
44import { ImageResponse } from '@vercel/og'
5+ import ky from 'ky'
56
67import { api , apiHost } from '@/lib/config'
78import { NotionPageInfo } from '@/lib/types'
@@ -30,15 +31,11 @@ export default async function OGImage(req: NextRequest) {
3031 return new Response ( 'Invalid notion page id' , { status : 400 } )
3132 }
3233
33- const pageInfoRes = await fetch ( `${ apiHost } ${ api . getNotionPageInfo } ` , {
34- method : 'POST' ,
35- body : JSON . stringify ( { pageId } ) ,
36- headers : { 'Content-Type' : 'application/json' }
37- } )
38- if ( ! pageInfoRes . ok ) {
39- return new Response ( pageInfoRes . statusText , { status : pageInfoRes . status } )
40- }
41- const pageInfo : NotionPageInfo = await pageInfoRes . json ( )
34+ const pageInfo = await ky
35+ . post ( `${ apiHost } ${ api . getNotionPageInfo } ` , {
36+ json : { pageId }
37+ } )
38+ . json < NotionPageInfo > ( )
4239 console . log ( pageInfo )
4340
4441 return new ImageResponse (
@@ -86,7 +83,7 @@ export default async function OGImage(req: NextRequest) {
8683 style = { {
8784 position : 'relative' ,
8885 width : 900 ,
89- height : 450 ,
86+ height : 465 ,
9087 display : 'flex' ,
9188 flexDirection : 'column' ,
9289 border : '16px solid rgba(0,0,0,0.3)' ,
@@ -133,7 +130,7 @@ export default async function OGImage(req: NextRequest) {
133130 < div
134131 style = { {
135132 position : 'absolute' ,
136- top : 32 ,
133+ top : 47 ,
137134 left : 104 ,
138135 height : 128 ,
139136 width : 128 ,
@@ -157,7 +154,7 @@ export default async function OGImage(req: NextRequest) {
157154 ) ,
158155 {
159156 width : 1200 ,
160- height : 600 ,
157+ height : 630 ,
161158 fonts : [
162159 {
163160 name : 'Inter' ,
0 commit comments