Skip to content

Commit

Permalink
fix(integrations): 🐛 Get data when extracting 1 column
Browse files Browse the repository at this point in the history
  • Loading branch information
baptisteArno committed Mar 2, 2022
1 parent 507fe4f commit 1bf3baf
Showing 1 changed file with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,11 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
column: req.query['referenceCell[column]'],
value: req.query['referenceCell[value]'],
} as Cell
const extractingColumns = req.query.columns as string[] | undefined
if (!Array.isArray(extractingColumns)) return badRequest(res)

const extractingColumns = getExtractingColumns(
req.query.columns as string[] | string | undefined
)
if (!extractingColumns) return badRequest(res)
const doc = new GoogleSpreadsheet(spreadsheetId)
doc.useOAuth2Client(await getAuthenticatedGoogleClient(credentialsId))
await doc.loadInfo()
Expand Down Expand Up @@ -80,4 +83,9 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
return methodNotAllowed(res)
}

const getExtractingColumns = (columns: string | string[] | undefined) => {
if (typeof columns === 'string') return [columns]
if (Array.isArray(columns)) return columns
}

export default withSentry(handler)

2 comments on commit 1bf3baf

@vercel
Copy link

@vercel vercel bot commented on 1bf3baf Mar 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 1bf3baf Mar 2, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

builder-v2 – ./apps/builder

app.typebot.io
builder-v2-git-main-typebot-io.vercel.app
builder-v2-typebot-io.vercel.app

Please sign in to comment.