(sheets) Use Google Drive picker and remove sensitive OAuth scope

BREAKING CHANGE: The Google Picker API needs to be enabled in the Google Cloud console. You also need to enable it in
your NEXT_PUBLIC_GOOGLE_API_KEY. You also need to add the drive.file OAuth scope.
This commit is contained in:
Baptiste Arnaud
2023-12-18 15:43:58 +01:00
parent 2dec0b88c2
commit deab1a12e9
23 changed files with 428 additions and 156 deletions

View File

@@ -10,8 +10,7 @@ import {
Text,
} from '@chakra-ui/react'
import { ChevronLeftIcon, PlusIcon, TrashIcon } from '@/components/icons'
import React, { useCallback, useEffect, useState } from 'react'
import { useRouter } from 'next/router'
import React, { useCallback, useState } from 'react'
import { useToast } from '../../../hooks/useToast'
import { Credentials } from '@typebot.io/schemas'
import { trpc } from '@/lib/trpc'
@@ -37,7 +36,6 @@ export const CredentialsDropdown = ({
credentialsName,
...props
}: Props) => {
const router = useRouter()
const { showToast } = useToast()
const { currentRole } = useWorkspace()
const { data, refetch } = trpc.credentials.listCredentials.useQuery({
@@ -77,25 +75,6 @@ export const CredentialsDropdown = ({
[onCredentialsSelect]
)
const clearQueryParams = useCallback(() => {
const hasQueryParams = router.asPath.includes('?')
if (hasQueryParams)
router.push(router.asPath.split('?')[0], undefined, { shallow: true })
}, [router])
useEffect(() => {
if (!router.isReady) return
if (router.query.credentialsId) {
handleMenuItemClick(router.query.credentialsId.toString())()
clearQueryParams()
}
}, [
clearQueryParams,
handleMenuItemClick,
router.isReady,
router.query.credentialsId,
])
const deleteCredentials =
(credentialsId: string) => async (e: React.MouseEvent) => {
e.stopPropagation()