2
0

fix(results): 🐛 Fix variables parsing

This commit is contained in:
Baptiste Arnaud
2022-04-06 10:31:02 +02:00
parent 5ce0212476
commit e9c3ec1e46
2 changed files with 7 additions and 3 deletions

View File

@@ -31,6 +31,7 @@ export const TemplatesModal = ({ isOpen, onClose, onTypebotChoose }: Props) => {
const [selectedTemplate, setSelectedTemplate] = useState<TemplateProps>(
templates[0]
)
const [isLoading, setIsLoading] = useState(false)
const toast = useToast({
position: 'top-right',
@@ -78,7 +79,10 @@ export const TemplatesModal = ({ isOpen, onClose, onTypebotChoose }: Props) => {
<Stack spacing={4}>
<Button
colorScheme="blue"
onClick={() => typebot && onTypebotChoose(typebot)}
onClick={() =>
typebot && onTypebotChoose(typebot) && setIsLoading(true)
}
isLoading={isLoading}
>
Use this template
</Button>

View File

@@ -114,8 +114,8 @@ export const parseAnswers =
}
}
const variable = answerOrVariable as VariableWithValue
if (isDefined(o[variable.id])) return o
return { ...o, [variable.id]: variable.value }
if (isDefined(o[variable.name])) return o
return { ...o, [variable.name]: variable.value }
}, {}),
}
}