fix registration

This commit is contained in:
Tatiana Nikolaeva 2025-06-02 18:23:14 +05:00
parent 2ec9354fc1
commit 08f827267d
12 changed files with 84 additions and 88 deletions

View file

@ -7,34 +7,16 @@ import {getSurveyById, ISurvey} from "../../api/SurveyApi.ts";
import {getListQuestions} from "../../api/QuestionApi.ts";
import {getAnswerVariants, IAnswerVariant} from "../../api/AnswerVariantsApi.ts";
export const CompletingSurvey = () => {
// const [titleSurvey, setTitleSurvey] = useState("Название опроса");
// const [descriptionSurvey, setDescriptionSurvey] = useState("");
// const [questions, setQuestions] = useState<Question[]>([
// { id: 1, text: 'Вопрос 1', questionType: 'SingleAnswerQuestion', answerVariants: [{ id: 1, text: 'Ответ 1' },
// { id: 2, text: 'Ответ 1' }, { id: 3, text: 'Ответ 1' }]},
// { id: 2, text: 'Вопрос 2', questionType: 'MultipleAnswerQuestion', answerVariants: [{ id: 1, text: 'Ответ 1' },
// { id: 2, text: 'Ответ 1' }, { id: 3, text: 'Ответ 1' }]}
// ]);
// const [questions, setQuestions] = useState<Question[]>([]);
// const [loading, setLoading] = useState(true);
// const [error, setError] = useState<string | null>(null);
//
// const [description, setDescription] = useState('');
// const [title, setTitle] = useState('');
//
// const { survey, setSurvey } = useOutletContext<{
// survey: ISurvey;
// setSurvey: (survey: ISurvey) => void;
// }>();
const {surveyId} = useParams<{surveyId: string}>();
const [survey, setSurvey] = useState<ISurvey | null>(null);
const [questions, setQuestions] = useState<Question[]>([]);
const [loading, setLoading] = useState(true);
const [error, setError] = useState<string | null>(null);
useEffect(() => {
const fetchSurveyData = async () => {
try {
@ -73,6 +55,7 @@ export const CompletingSurvey = () => {
if (error) return <div>{error}</div>;
if (!survey) return <div>Опрос не найден</div>;
return (
<div className={styles.survey}>
<SurveyInfo
@ -85,6 +68,7 @@ export const CompletingSurvey = () => {
questions={questions}
setQuestions={setQuestions}
/>
<button className={styles.departur_button}>Отправить</button>
</div>
)
}