import React, { useEffect, useState } from "react"; import { useNavigate } from "react-router-dom"; import { baseImageUrl, surveyApi } from "../apis"; import { ISurvey } from "../types"; import { MySurveyCard } from "./MySurveyCard"; export const Profile = () => { const navigate = useNavigate(); const [survey, setSurvey] = useState({ _id: "", user: {}, title: "", comment: "", questions: [], }); const [cardDatas, setCardDatas] = useState([]); useEffect(() => { getSurveys(); }, []); async function createSurvey() { const newSurvey: ISurvey = await surveyApi.createSurvey(survey); navigate(`/surveys/${newSurvey._id}/create`, { replace: true, }); } async function getSurveys() { const surveys: ISurvey[] = await surveyApi.getSurveys(); // console.log(surveys); setCardDatas(surveys); } // let surveys = getSurvey(_id); return (
나의 설문조사
{cardDatas.map((data, index) => { return ; })}
); };