fix(results): 🐛 Fix variables parsing
This commit is contained in:
@@ -31,6 +31,7 @@ export const TemplatesModal = ({ isOpen, onClose, onTypebotChoose }: Props) => {
|
|||||||
const [selectedTemplate, setSelectedTemplate] = useState<TemplateProps>(
|
const [selectedTemplate, setSelectedTemplate] = useState<TemplateProps>(
|
||||||
templates[0]
|
templates[0]
|
||||||
)
|
)
|
||||||
|
const [isLoading, setIsLoading] = useState(false)
|
||||||
|
|
||||||
const toast = useToast({
|
const toast = useToast({
|
||||||
position: 'top-right',
|
position: 'top-right',
|
||||||
@@ -78,7 +79,10 @@ export const TemplatesModal = ({ isOpen, onClose, onTypebotChoose }: Props) => {
|
|||||||
<Stack spacing={4}>
|
<Stack spacing={4}>
|
||||||
<Button
|
<Button
|
||||||
colorScheme="blue"
|
colorScheme="blue"
|
||||||
onClick={() => typebot && onTypebotChoose(typebot)}
|
onClick={() =>
|
||||||
|
typebot && onTypebotChoose(typebot) && setIsLoading(true)
|
||||||
|
}
|
||||||
|
isLoading={isLoading}
|
||||||
>
|
>
|
||||||
Use this template
|
Use this template
|
||||||
</Button>
|
</Button>
|
||||||
|
|||||||
@@ -114,8 +114,8 @@ export const parseAnswers =
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
const variable = answerOrVariable as VariableWithValue
|
const variable = answerOrVariable as VariableWithValue
|
||||||
if (isDefined(o[variable.id])) return o
|
if (isDefined(o[variable.name])) return o
|
||||||
return { ...o, [variable.id]: variable.value }
|
return { ...o, [variable.name]: variable.value }
|
||||||
}, {}),
|
}, {}),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user