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