➖ Use minio for presigned urls and remove aws sdk
This commit is contained in:
@@ -52,7 +52,6 @@
|
||||
"@upstash/ratelimit": "^0.4.3",
|
||||
"@upstash/redis": "^1.22.0",
|
||||
"@use-gesture/react": "^10.2.27",
|
||||
"aws-sdk": "2.1415.0",
|
||||
"browser-image-compression": "2.0.2",
|
||||
"canvas-confetti": "1.6.0",
|
||||
"codemirror": "6.0.1",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useToast } from '@/hooks/useToast'
|
||||
import { Button, ButtonProps, chakra } from '@chakra-ui/react'
|
||||
import { ChangeEvent, useState } from 'react'
|
||||
import { uploadFiles } from '@typebot.io/lib'
|
||||
import { uploadFiles } from '@typebot.io/lib/uploadFiles'
|
||||
import { compressFile } from '@/helpers/compressFile'
|
||||
|
||||
type UploadButtonProps = {
|
||||
|
||||
@@ -90,11 +90,17 @@ export const TypebotProvider = ({
|
||||
{ typebotId: typebotId as string },
|
||||
{
|
||||
enabled: isDefined(typebotId),
|
||||
onError: (error) =>
|
||||
onError: (error) => {
|
||||
if (error.data?.httpStatus === 404) {
|
||||
showToast({ status: 'info', description: "Couldn't find typebot" })
|
||||
push('/typebots')
|
||||
return
|
||||
}
|
||||
showToast({
|
||||
title: 'Error while fetching typebot. Refresh the page.',
|
||||
description: error.message,
|
||||
}),
|
||||
})
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -103,11 +109,13 @@ export const TypebotProvider = ({
|
||||
{ typebotId: typebotId as string },
|
||||
{
|
||||
enabled: isDefined(typebotId),
|
||||
onError: (error) =>
|
||||
onError: (error) => {
|
||||
if (error.data?.httpStatus === 404) return
|
||||
showToast({
|
||||
title: 'Error while fetching published typebot',
|
||||
description: error.message,
|
||||
}),
|
||||
})
|
||||
},
|
||||
}
|
||||
)
|
||||
|
||||
@@ -134,12 +142,7 @@ export const TypebotProvider = ({
|
||||
|
||||
useEffect(() => {
|
||||
if (!typebot && isDefined(localTypebot)) setLocalTypebot(undefined)
|
||||
if (isFetchingTypebot) return
|
||||
if (!typebot) {
|
||||
showToast({ status: 'info', description: "Couldn't find typebot" })
|
||||
push('/typebots')
|
||||
return
|
||||
}
|
||||
if (isFetchingTypebot || !typebot) return
|
||||
if (
|
||||
typebot.id !== localTypebot?.id ||
|
||||
new Date(typebot.updatedAt).getTime() >
|
||||
|
||||
@@ -25,7 +25,7 @@ const handler = async (
|
||||
const filePath = req.query.filePath as string | undefined
|
||||
const fileType = req.query.fileType as string | undefined
|
||||
if (!filePath || !fileType) return badRequest(res)
|
||||
const presignedUrl = generatePresignedUrl({ fileType, filePath })
|
||||
const presignedUrl = await generatePresignedUrl({ fileType, filePath })
|
||||
|
||||
return res.status(200).send({ presignedUrl })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user