(credentials) Add credentials management menu in workspace settings

Closes #1567
This commit is contained in:
Baptiste Arnaud
2024-07-16 15:11:48 +02:00
parent db628cd051
commit c6005c49a2
81 changed files with 3582 additions and 1704 deletions

View File

@@ -16,7 +16,12 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
if (!state) return badRequest(res)
const { typebotId, redirectUrl, blockId, workspaceId } = JSON.parse(
Buffer.from(state, 'base64').toString()
)
) as {
redirectUrl: string
workspaceId: string
typebotId?: string
blockId?: string
}
if (req.method === 'GET') {
const code = req.query.code as string | undefined
if (!workspaceId) return badRequest(res)
@@ -55,6 +60,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
const { id: credentialsId } = await prisma.credentials.create({
data: credentials,
})
if (!typebotId) return res.redirect(`${redirectUrl.split('?')[0]}`)
const typebot = await prisma.typebot.findFirst({
where: {
id: typebotId,