@@ -2,6 +2,7 @@ import * as React from 'react'
2
2
import { NextRequest } from 'next/server'
3
3
4
4
import { ImageResponse } from '@vercel/og'
5
+ import ky from 'ky'
5
6
6
7
import { api , apiHost } from '@/lib/config'
7
8
import { NotionPageInfo } from '@/lib/types'
@@ -30,15 +31,11 @@ export default async function OGImage(req: NextRequest) {
30
31
return new Response ( 'Invalid notion page id' , { status : 400 } )
31
32
}
32
33
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 > ( )
42
39
console . log ( pageInfo )
43
40
44
41
return new ImageResponse (
@@ -86,7 +83,7 @@ export default async function OGImage(req: NextRequest) {
86
83
style = { {
87
84
position : 'relative' ,
88
85
width : 900 ,
89
- height : 450 ,
86
+ height : 465 ,
90
87
display : 'flex' ,
91
88
flexDirection : 'column' ,
92
89
border : '16px solid rgba(0,0,0,0.3)' ,
@@ -133,7 +130,7 @@ export default async function OGImage(req: NextRequest) {
133
130
< div
134
131
style = { {
135
132
position : 'absolute' ,
136
- top : 32 ,
133
+ top : 47 ,
137
134
left : 104 ,
138
135
height : 128 ,
139
136
width : 128 ,
@@ -157,7 +154,7 @@ export default async function OGImage(req: NextRequest) {
157
154
) ,
158
155
{
159
156
width : 1200 ,
160
- height : 600 ,
157
+ height : 630 ,
161
158
fonts : [
162
159
{
163
160
name : 'Inter' ,
0 commit comments