mirror of
https://github.com/d0zingcat/nextjs-notion-starter-kit.git
synced 2026-05-30 15:10:55 +00:00
feat: make preview image support optional
This commit is contained in:
@@ -3,6 +3,7 @@ import { NextApiRequest, NextApiResponse } from 'next'
|
||||
import got from 'got'
|
||||
import lqip from 'lqip-modern'
|
||||
|
||||
import { isPreviewImageSupportEnabled } from '../lib/config'
|
||||
import * as types from '../lib/types'
|
||||
import * as db from '../lib/db'
|
||||
|
||||
@@ -11,6 +12,14 @@ export default async (req: NextApiRequest, res: NextApiResponse) => {
|
||||
return res.status(405).send({ error: 'method not allowed' })
|
||||
}
|
||||
|
||||
if (!isPreviewImageSupportEnabled) {
|
||||
return res
|
||||
.status(418)
|
||||
.send({
|
||||
error: 'preview image support has been disabled for this deployment'
|
||||
})
|
||||
}
|
||||
|
||||
const { url, id } = req.body
|
||||
|
||||
const result = await createPreviewImage(url, id)
|
||||
|
||||
Reference in New Issue
Block a user