fix: 🐛 Tiny bugs (Sentry)
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -16,6 +16,7 @@ test-results
|
|||||||
.docusaurus
|
.docusaurus
|
||||||
.cache-loader
|
.cache-loader
|
||||||
build
|
build
|
||||||
|
firebaseServiceAccount.json
|
||||||
|
|
||||||
# Wordpress
|
# Wordpress
|
||||||
.svn
|
.svn
|
||||||
|
|||||||
@@ -83,15 +83,17 @@ export const CredentialsDropdown = ({
|
|||||||
router.push(router.asPath.split('?')[0], undefined, { shallow: true })
|
router.push(router.asPath.split('?')[0], undefined, { shallow: true })
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleDeleteDomainClick = (credentialsId: string) => async () => {
|
const handleDeleteDomainClick =
|
||||||
if (!user?.id) return
|
(credentialsId: string) => async (e: React.MouseEvent) => {
|
||||||
setIsDeleting(credentialsId)
|
e.stopPropagation()
|
||||||
const { error } = await deleteCredentials(user?.id, credentialsId)
|
if (!user?.id) return
|
||||||
setIsDeleting(undefined)
|
setIsDeleting(credentialsId)
|
||||||
if (error) return toast({ title: error.name, description: error.message })
|
const { error } = await deleteCredentials(user?.id, credentialsId)
|
||||||
onCredentialsSelect(undefined)
|
setIsDeleting(undefined)
|
||||||
mutate({ credentials: credentials.filter((c) => c.id !== credentialsId) })
|
if (error) return toast({ title: error.name, description: error.message })
|
||||||
}
|
onCredentialsSelect(undefined)
|
||||||
|
mutate({ credentials: credentials.filter((c) => c.id !== credentialsId) })
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Menu isLazy placement="bottom-end" matchWidth>
|
<Menu isLazy placement="bottom-end" matchWidth>
|
||||||
@@ -121,7 +123,7 @@ export const CredentialsDropdown = ({
|
|||||||
</MenuItem>
|
</MenuItem>
|
||||||
)}
|
)}
|
||||||
{credentialsList.map((credentials) => (
|
{credentialsList.map((credentials) => (
|
||||||
<Button
|
<MenuItem
|
||||||
role="menuitem"
|
role="menuitem"
|
||||||
minH="40px"
|
minH="40px"
|
||||||
key={credentials.id}
|
key={credentials.id}
|
||||||
@@ -129,8 +131,6 @@ export const CredentialsDropdown = ({
|
|||||||
fontSize="16px"
|
fontSize="16px"
|
||||||
fontWeight="normal"
|
fontWeight="normal"
|
||||||
rounded="none"
|
rounded="none"
|
||||||
colorScheme="gray"
|
|
||||||
variant="ghost"
|
|
||||||
justifyContent="space-between"
|
justifyContent="space-between"
|
||||||
>
|
>
|
||||||
{credentials.name}
|
{credentials.name}
|
||||||
@@ -141,7 +141,7 @@ export const CredentialsDropdown = ({
|
|||||||
onClick={handleDeleteDomainClick(credentials.id)}
|
onClick={handleDeleteDomainClick(credentials.id)}
|
||||||
isLoading={isDeleting === credentials.id}
|
isLoading={isDeleting === credentials.id}
|
||||||
/>
|
/>
|
||||||
</Button>
|
</MenuItem>
|
||||||
))}
|
))}
|
||||||
<MenuItem
|
<MenuItem
|
||||||
maxW="500px"
|
maxW="500px"
|
||||||
|
|||||||
@@ -89,6 +89,7 @@ export const deleteEdgeDraft = (
|
|||||||
edgeId: string
|
edgeId: string
|
||||||
) => {
|
) => {
|
||||||
const edgeIndex = typebot.edges.findIndex(byId(edgeId))
|
const edgeIndex = typebot.edges.findIndex(byId(edgeId))
|
||||||
|
if (edgeIndex === -1) return
|
||||||
deleteOutgoingEdgeIdProps(typebot, edgeIndex)
|
deleteOutgoingEdgeIdProps(typebot, edgeIndex)
|
||||||
typebot.edges.splice(edgeIndex, 1)
|
typebot.edges.splice(edgeIndex, 1)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,14 +16,14 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
if (req.method === 'GET') {
|
if (req.method === 'GET') {
|
||||||
const credentialsId = req.query.credentialsId.toString()
|
const credentialsId = req.query.credentialsId.toString()
|
||||||
const auth = await getAuthenticatedGoogleClient(user.id, credentialsId)
|
const auth = await getAuthenticatedGoogleClient(user.id, credentialsId)
|
||||||
const { data } = await drive({
|
const response = await drive({
|
||||||
version: 'v3',
|
version: 'v3',
|
||||||
auth,
|
auth,
|
||||||
}).files.list({
|
}).files.list({
|
||||||
q: "mimeType='application/vnd.google-apps.spreadsheet'",
|
q: "mimeType='application/vnd.google-apps.spreadsheet'",
|
||||||
fields: 'nextPageToken, files(id, name)',
|
fields: 'nextPageToken, files(id, name)',
|
||||||
})
|
})
|
||||||
return res.send(data)
|
return res.send(response.data)
|
||||||
}
|
}
|
||||||
return methodNotAllowed(res)
|
return methodNotAllowed(res)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ export const TypebotPage = ({
|
|||||||
}, [])
|
}, [])
|
||||||
|
|
||||||
const initializeResult = async (variables: VariableWithValue[]) => {
|
const initializeResult = async (variables: VariableWithValue[]) => {
|
||||||
const resultIdFromSession = sessionStorage.getItem(sessionStorageKey)
|
const resultIdFromSession = getExistingResultFromSession()
|
||||||
if (resultIdFromSession) setResultId(resultIdFromSession)
|
if (resultIdFromSession) setResultId(resultIdFromSession)
|
||||||
else {
|
else {
|
||||||
const { error, data: result } = await createResult(
|
const { error, data: result } = await createResult(
|
||||||
@@ -41,7 +41,7 @@ export const TypebotPage = ({
|
|||||||
if (error) setError(error)
|
if (error) setError(error)
|
||||||
if (result) {
|
if (result) {
|
||||||
setResultId(result.id)
|
setResultId(result.id)
|
||||||
sessionStorage.setItem(sessionStorageKey, result.id)
|
setResultInSession(result.id)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -79,3 +79,15 @@ export const TypebotPage = ({
|
|||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const getExistingResultFromSession = () => {
|
||||||
|
try {
|
||||||
|
return sessionStorage.getItem(sessionStorageKey)
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|
||||||
|
const setResultInSession = (resultId: string) => {
|
||||||
|
try {
|
||||||
|
return sessionStorage.setItem(sessionStorageKey, resultId)
|
||||||
|
} catch {}
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { NextApiRequest, NextApiResponse } from 'next'
|
import { NextApiRequest, NextApiResponse } from 'next'
|
||||||
import { initMiddleware, methodNotAllowed } from 'utils'
|
import { badRequest, initMiddleware, methodNotAllowed } from 'utils'
|
||||||
import { GoogleSpreadsheet } from 'google-spreadsheet'
|
import { GoogleSpreadsheet } from 'google-spreadsheet'
|
||||||
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
import { getAuthenticatedGoogleClient } from 'libs/google-sheets'
|
||||||
import { Cell } from 'models'
|
import { Cell } from 'models'
|
||||||
@@ -17,7 +17,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
|
|||||||
column: req.query['referenceCell[column]'],
|
column: req.query['referenceCell[column]'],
|
||||||
value: req.query['referenceCell[value]'],
|
value: req.query['referenceCell[value]'],
|
||||||
} as Cell
|
} as Cell
|
||||||
const extractingColumns = req.query.columns as string[]
|
const extractingColumns = req.query.columns as string[] | undefined
|
||||||
|
if (!Array.isArray(extractingColumns)) return badRequest(res)
|
||||||
const doc = new GoogleSpreadsheet(spreadsheetId)
|
const doc = new GoogleSpreadsheet(spreadsheetId)
|
||||||
doc.useOAuth2Client(await getAuthenticatedGoogleClient(credentialsId))
|
doc.useOAuth2Client(await getAuthenticatedGoogleClient(credentialsId))
|
||||||
await doc.loadInfo()
|
await doc.loadInfo()
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
import { PrismaClient } from 'db'
|
import { PrismaClient } from 'db'
|
||||||
import { randomUUID } from 'crypto'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
|
||||||
require('dotenv').config({
|
require('dotenv').config({
|
||||||
@@ -10,11 +9,6 @@ require('dotenv').config({
|
|||||||
})
|
})
|
||||||
|
|
||||||
const prisma = new PrismaClient()
|
const prisma = new PrismaClient()
|
||||||
const main = async () => {
|
const main = async () => {}
|
||||||
await prisma.user.updateMany({
|
|
||||||
where: { apiToken: null },
|
|
||||||
data: { apiToken: randomUUID() },
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
main().then()
|
main().then()
|
||||||
|
|||||||
@@ -11,5 +11,8 @@
|
|||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"db": "*",
|
"db": "*",
|
||||||
"ts-node": "^10.5.0"
|
"ts-node": "^10.5.0"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"firebase-admin": "^10.0.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user