fix form submit bug

This commit is contained in:
Dobromir Popov
2024-06-21 14:51:08 +03:00
parent cdd9e1f04a
commit d1d0ca667e

View File

@ -62,8 +62,8 @@ const SurveyForm: React.FC<SurveyFormProps> = ({ existingItem }) => {
...existingItem, ...existingItem,
content: existingItem?.content || "Нова анкета", content: existingItem?.content || "Нова анкета",
answers: existingItem?.answers.split(",") || [], answers: existingItem?.answers.split(",") || [],
publicFrom: existingItem?.publicFrom ? dayjs(existingItem.publicFrom).toISOString() : new Date().toISOString(), publicFrom: existingItem?.publicFrom ? dayjs(existingItem.publicFrom).toISOString() : '',
publicUntil: existingItem?.publicUntil ? dayjs(existingItem.publicUntil).toISOString() : new Date().toISOString(), publicUntil: existingItem?.publicUntil ? dayjs(existingItem.publicUntil).toISOString() : null,
}); });
@ -104,7 +104,7 @@ const SurveyForm: React.FC<SurveyFormProps> = ({ existingItem }) => {
} }
else { else {
//get all publisherIds and create a message for each //get all publisherIds and create a message for each
const messages = pubs.data.map(pub => { const messages = pubs.map(pub => {
return { return {
publisherId: pub.id, publisherId: pub.id,
content: JSON.stringify({ message: item.content, options: item.answers }), content: JSON.stringify({ message: item.content, options: item.answers }),