2
0

feat(bot): ️ Add custom file upload size limit

This commit is contained in:
Baptiste Arnaud
2022-06-21 16:53:45 +02:00
parent 1931a5c9c0
commit ea765640cf
17 changed files with 141 additions and 44 deletions

View File

@ -35,6 +35,7 @@ export const TypebotPage = ({
const [variableUpdateQueue, setVariableUpdateQueue] = useState<
VariableWithValue[][]
>([])
const [chatStarted, setChatStarted] = useState(false)
useEffect(() => {
setShowTypebot(true)
@ -94,10 +95,16 @@ export const TypebotPage = ({
if (error) setError(error)
}
const handleNewAnswer = async (answer: Answer) => {
const handleNewAnswer = async (
answer: Answer & { uploadedFiles: boolean }
) => {
if (!resultId) return setError(new Error('Result was not created'))
const { error } = await upsertAnswer({ ...answer, resultId })
if (error) setError(error)
if (chatStarted) return
updateResult(resultId, {
hasStarted: true,
}).then(({ error }) => (error ? setError(error) : setChatStarted(true)))
}
const handleCompleted = async () => {