Skip to content

Commit 0e43254

Browse files
🕯
1 parent cc908f7 commit 0e43254

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ export const redisNamespace: string | null = getEnv(
125125
export const isServer = typeof window === 'undefined'
126126

127127
export const port = getEnv('PORT', '3000')
128-
export const host = isDev
129-
? `http://localhost:${port}`
128+
export const host = isDev ? `http://localhost:${port}` : `https://${domain}`
129+
export const apiHost = isDev
130+
? host
130131
: `https://${process.env.VERCEL_URL || domain}`
131132

132133
export const apiBaseUrl = `/api`

pages/api/social-image.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { ImageResponse } from '@vercel/og'
33
import { NextRequest } from 'next/server'
44

55
import { NotionPageInfo } from 'lib/types'
6-
import { host, api } from 'lib/config'
6+
import { apiHost, api } from 'lib/config'
77

88
const interRegularFontP = fetch(
99
new URL('../../public/fonts/Inter-Regular.ttf', import.meta.url)
@@ -29,7 +29,7 @@ export default async function OGImage(req: NextRequest) {
2929
return new Response('Invalid notion page id', { status: 400 })
3030
}
3131

32-
const pageInfoRes = await fetch(`${host}${api.getNotionPageInfo}`, {
32+
const pageInfoRes = await fetch(`${apiHost}${api.getNotionPageInfo}`, {
3333
method: 'POST',
3434
body: JSON.stringify({ pageId }),
3535
headers: { 'Content-Type': 'application/json' }

0 commit comments

Comments
 (0)