2
0

♻️ (builder) Change to features-centric folder structure

This commit is contained in:
Baptiste Arnaud
2022-11-15 09:35:48 +01:00
committed by Baptiste Arnaud
parent 3686465a85
commit 643571fe7d
683 changed files with 3907 additions and 3643 deletions

View File

@ -0,0 +1,23 @@
import { withSentry } from '@sentry/nextjs'
import { oauth2Client } from '@/lib/googleSheets'
import { NextApiRequest, NextApiResponse } from 'next'
export const googleSheetsScopes = [
'https://www.googleapis.com/auth/userinfo.email',
'https://www.googleapis.com/auth/spreadsheets',
'https://www.googleapis.com/auth/drive.readonly',
]
const handler = (req: NextApiRequest, res: NextApiResponse) => {
if (req.method === 'GET') {
const url = oauth2Client.generateAuthUrl({
access_type: 'offline',
scope: googleSheetsScopes,
prompt: 'consent',
state: Buffer.from(JSON.stringify(req.query)).toString('base64'),
})
res.status(301).redirect(url)
}
}
export default withSentry(handler)