mirror of
https://github.com/stefanpejcic/openpanel
synced 2025-06-26 18:28:26 +00:00
teas
This commit is contained in:
parent
e91e495668
commit
e4b92c5134
@ -54,30 +54,29 @@ export const DocSurveyWidget = ({ className }: Props) => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleSurveyTextSubmit = async (text: string) => {
|
const handleSurveyTextSubmit = async (text: string) => {
|
||||||
if (text.trim() === "") {
|
if (text.trim() === "") {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const surveyIdToUpdate = survey?.id; // Use the existing survey ID if available
|
const data = await updateSurvey({
|
||||||
|
surveyId: survey.id,
|
||||||
|
body: { response: selectedOption, responseText: text },
|
||||||
|
});
|
||||||
|
if (!data) return;
|
||||||
|
|
||||||
const data = await updateSurvey({
|
setSurvey(data);
|
||||||
surveyId: surveyIdToUpdate,
|
// when the user submits text feedback, we show a thank you message
|
||||||
body: { response: selectedOption, responseText: text },
|
setIsFinished(true);
|
||||||
});
|
|
||||||
|
|
||||||
if (!data) return;
|
// reset the survey after N seconds so that the user can submit another survey
|
||||||
|
setTimeout(() => {
|
||||||
setSurvey(data);
|
setSelectedOption(null);
|
||||||
setIsFinished(true);
|
setSurvey(null);
|
||||||
|
setIsFinished(false);
|
||||||
setTimeout(() => {
|
setIsSurveyTextVisible(false);
|
||||||
setSelectedOption(null);
|
}, 3000);
|
||||||
setSurvey(null);
|
};
|
||||||
setIsFinished(false);
|
|
||||||
setIsSurveyTextVisible(false);
|
|
||||||
}, 3000);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
Loading…
Reference in New Issue
Block a user