This commit is contained in:
Travis Fischer
2022-10-14 19:24:12 -04:00
parent cc908f708b
commit 0e432545eb
2 changed files with 5 additions and 4 deletions

View File

@@ -125,8 +125,9 @@ export const redisNamespace: string | null = getEnv(
export const isServer = typeof window === 'undefined'
export const port = getEnv('PORT', '3000')
export const host = isDev
? `http://localhost:${port}`
export const host = isDev ? `http://localhost:${port}` : `https://${domain}`
export const apiHost = isDev
? host
: `https://${process.env.VERCEL_URL || domain}`
export const apiBaseUrl = `/api`

View File

@@ -3,7 +3,7 @@ import { ImageResponse } from '@vercel/og'
import { NextRequest } from 'next/server'
import { NotionPageInfo } from 'lib/types'
import { host, api } from 'lib/config'
import { apiHost, api } from 'lib/config'
const interRegularFontP = fetch(
new URL('../../public/fonts/Inter-Regular.ttf', import.meta.url)
@@ -29,7 +29,7 @@ export default async function OGImage(req: NextRequest) {
return new Response('Invalid notion page id', { status: 400 })
}
const pageInfoRes = await fetch(`${host}${api.getNotionPageInfo}`, {
const pageInfoRes = await fetch(`${apiHost}${api.getNotionPageInfo}`, {
method: 'POST',
body: JSON.stringify({ pageId }),
headers: { 'Content-Type': 'application/json' }