Commit 73188bcd authored by Lee SeoYeon's avatar Lee SeoYeon
Browse files

.

parent a6bbadc0
...@@ -7,3 +7,8 @@ export const createSurvey = async (survey:SurveyType) => { ...@@ -7,3 +7,8 @@ export const createSurvey = async (survey:SurveyType) => {
const {data} = await axios.post(`${baseUrl}/surveys/create`, {...survey}) const {data} = await axios.post(`${baseUrl}/surveys/create`, {...survey})
return data; return data;
} }
// export const getSurvey = async () => {
// const {data} = await axios.get(`${baseUrl}/surveys/profile`)
// return data;
// }
\ No newline at end of file
...@@ -16,6 +16,32 @@ export const ACheckboxForm = () => { ...@@ -16,6 +16,32 @@ export const ACheckboxForm = () => {
/> />
<input className="ml-2 text-lg font-medium">First checkbox</input> <input className="ml-2 text-lg font-medium">First checkbox</input>
</div> </div>
<div className="mb-4 mx-3">
<input
id="default-checkbox"
type="checkbox"
className="w-5 h-5 mt-3 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
/>
<label className="ml-2 text-lg font-medium">Second checkbox</label>
</div>
<div className="mb-4 mx-3">
<input
id="default-checkbox"
type="checkbox"
value=""
className="w-5 h-5 mt-3 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
/>
<label className="ml-2 text-lg font-medium">Third checkbox</label>
</div>
<div className="mb-4 mx-4">
<input
id="default-checkbox"
type="checkbox"
value=""
className="w-5 h-5 mt-3 text-blue-600 bg-gray-100 rounded border-gray-300 focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"
/>
<label className="ml-2 text-lg font-medium">Fourth checkbox</label>
</div>
</div> </div>
</div> </div>
); );
......
...@@ -7,7 +7,7 @@ export const ADropdownForm = () => { ...@@ -7,7 +7,7 @@ export const ADropdownForm = () => {
<form className="text-xl font-bold ml-6 w-1/2">dropdown</form> <form className="text-xl font-bold ml-6 w-1/2">dropdown</form>
</div> </div>
<form className="border w-11/12 my-3">설문조사 설명</form> <form className="border w-11/12 my-3">설문조사 설명</form>
<select className="py-2 bg-themeColor rounded text-white"> <select className="py-2 hover:bg-themeColor bg-gray-200 rounded ">
<option selected>choose answer</option> <option selected>choose answer</option>
<option>first</option> <option>first</option>
<option>second</option> <option>second</option>
......
...@@ -15,7 +15,7 @@ export const SurveyForm = () => { ...@@ -15,7 +15,7 @@ export const SurveyForm = () => {
rows={2} rows={2}
cols={60} cols={60}
></textarea> ></textarea>
<ACheckboxForm></ACheckboxForm> {/* <ACheckboxForm></ACheckboxForm> */}
<ADropdownForm></ADropdownForm> <ADropdownForm></ADropdownForm>
<AEssayForm></AEssayForm> <AEssayForm></AEssayForm>
<ARadioForm></ARadioForm> <ARadioForm></ARadioForm>
......
...@@ -23,7 +23,7 @@ export const Home = () => { ...@@ -23,7 +23,7 @@ export const Home = () => {
<div className="flex h-14 w-28 items-center border-2 border-themeColor font-bold text-black bg-gray-200 hover:bg-themeColor rounded-lg "> <div className="flex h-14 w-28 items-center border-2 border-themeColor font-bold text-black bg-gray-200 hover:bg-themeColor rounded-lg ">
<button <button
type="button" type="button"
className="text-center h-full w-28 font-bold text-black place-items-center mb-3" className="text-center h-full w-28 font-bold text-black place-items-center"
onClick={clickHome} onClick={clickHome}
> >
+ +
......
import React from "react"; import React, { useState } from "react";
import { useNavigate } from "react-router-dom"; import { useNavigate } from "react-router-dom";
import { SurveyType } from "../types";
export const Profile = () => { export const Profile = () => {
const navigate = useNavigate(); const navigate = useNavigate();
// const [Ssurvey, setSsurvey] = useState<SurveyType>({
// title: "",
// comment: "",
// //questions 는 _id들의 배열
// questions: [],
// });
// function handleAnswer(event: React.ChangeEvent<HTMLInputElement>) {
// setSsurvey({
// ...survey,
// [event.currentTarget.name]: event.currentTarget.value,
// })
// }
const createSurvey = () => { const createSurvey = () => {
// 먼저 서버에 survey 테이블에 새로운 survey 항목 추가 로직 필요 // 먼저 서버에 survey 테이블에 새로운 survey 항목 추가 로직 필요
......
...@@ -7,3 +7,8 @@ export const createSurvey = asyncWrap(async (req, res) => { ...@@ -7,3 +7,8 @@ export const createSurvey = asyncWrap(async (req, res) => {
const newSurvey = await surveyDb.createSurvey(survey); const newSurvey = await surveyDb.createSurvey(survey);
return res.json(newSurvey); return res.json(newSurvey);
}); });
// export const getSurveys = asyncWrap(async (req, res) => {
// const surveys = await surveyDb.getSurveys();
// return res.json(surveys);
// });
...@@ -4,3 +4,8 @@ export const createSurvey = async (survey: ISurvey) => { ...@@ -4,3 +4,8 @@ export const createSurvey = async (survey: ISurvey) => {
const newSurvey = await Survey.create(survey); const newSurvey = await Survey.create(survey);
return newSurvey; return newSurvey;
}; };
// export const getSurveys = async () => {
// const surveys = await Survey.find({}).populate("questions")
// return surveys
// }
\ No newline at end of file
...@@ -7,4 +7,7 @@ router ...@@ -7,4 +7,7 @@ router
.route("/create") .route("/create")
.post(surveyCtrl.createSurvey); .post(surveyCtrl.createSurvey);
// router
// .route("/profile")
// .get(surveyCtrl.getSurveys)
export default router; export default router;
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment