fix(bot): 🐛 File upload in linked typebot
This commit is contained in:
@@ -20,10 +20,7 @@ export const FileUploadForm = ({
|
|||||||
onSubmit,
|
onSubmit,
|
||||||
onSkip,
|
onSkip,
|
||||||
}: Props) => {
|
}: Props) => {
|
||||||
const {
|
const { isPreview, currentTypebotId } = useTypebot()
|
||||||
isPreview,
|
|
||||||
typebot: { typebotId },
|
|
||||||
} = useTypebot()
|
|
||||||
const { resultId } = useAnswers()
|
const { resultId } = useAnswers()
|
||||||
const [selectedFiles, setSelectedFiles] = useState<File[]>([])
|
const [selectedFiles, setSelectedFiles] = useState<File[]>([])
|
||||||
const [isUploading, setIsUploading] = useState(false)
|
const [isUploading, setIsUploading] = useState(false)
|
||||||
@@ -59,7 +56,7 @@ export const FileUploadForm = ({
|
|||||||
})
|
})
|
||||||
setIsUploading(true)
|
setIsUploading(true)
|
||||||
const urls = await uploadFiles({
|
const urls = await uploadFiles({
|
||||||
basePath: `/api/typebots/${typebotId}/blocks/${id}`,
|
basePath: `/api/typebots/${currentTypebotId}/blocks/${id}`,
|
||||||
files: [
|
files: [
|
||||||
{
|
{
|
||||||
file,
|
file,
|
||||||
@@ -81,7 +78,7 @@ export const FileUploadForm = ({
|
|||||||
})
|
})
|
||||||
setIsUploading(true)
|
setIsUploading(true)
|
||||||
const urls = await uploadFiles({
|
const urls = await uploadFiles({
|
||||||
basePath: `/api/typebots/${typebotId}/blocks/${id}`,
|
basePath: `/api/typebots/${currentTypebotId}/blocks/${id}`,
|
||||||
files: files.map((file) => ({
|
files: files.map((file) => ({
|
||||||
file: file,
|
file: file,
|
||||||
path: `public/results/${resultId}/${id}/${file.name}`,
|
path: `public/results/${resultId}/${id}/${file.name}`,
|
||||||
|
|||||||
Reference in New Issue
Block a user