fix(viewer): 🐛 Link to public bot CORS
This commit is contained in:
@ -1,9 +1,13 @@
|
|||||||
import { withSentry } from '@sentry/nextjs'
|
import { withSentry } from '@sentry/nextjs'
|
||||||
import prisma from 'libs/prisma'
|
import prisma from 'libs/prisma'
|
||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { methodNotAllowed, notFound } from 'utils'
|
import Cors from 'cors'
|
||||||
|
import { initMiddleware, methodNotAllowed, notFound } from 'utils'
|
||||||
|
|
||||||
|
const cors = initMiddleware(Cors())
|
||||||
|
|
||||||
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
||||||
|
await cors(req, res)
|
||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
const typebotId = req.query.typebotId as string
|
const typebotId = req.query.typebotId as string
|
||||||
const typebot = await prisma.publicTypebot.findUnique({
|
const typebot = await prisma.publicTypebot.findUnique({
|
||||||
|
Reference in New Issue
Block a user