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

.

parent a6bbadc0
......@@ -6,4 +6,9 @@ export const createSurvey = async (survey:SurveyType) => {
console.log(survey)
const {data} = await axios.post(`${baseUrl}/surveys/create`, {...survey})
return data;
}
\ No newline at end of file
}
// 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 = () => {
/>
<input className="ml-2 text-lg font-medium">First checkbox</input>
</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>
);
......
......@@ -7,7 +7,7 @@ export const ADropdownForm = () => {
<form className="text-xl font-bold ml-6 w-1/2">dropdown</form>
</div>
<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>first</option>
<option>second</option>
......
......@@ -15,7 +15,7 @@ export const SurveyForm = () => {
rows={2}
cols={60}
></textarea>
<ACheckboxForm></ACheckboxForm>
{/* <ACheckboxForm></ACheckboxForm> */}
<ADropdownForm></ADropdownForm>
<AEssayForm></AEssayForm>
<ARadioForm></ARadioForm>
......
......@@ -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 ">
<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}
>
+
......
import React from "react";
import React, { useState } from "react";
import { useNavigate } from "react-router-dom";
import { SurveyType } from "../types";
export const Profile = () => {
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 = () => {
// 먼저 서버에 survey 테이블에 새로운 survey 항목 추가 로직 필요
......
......@@ -6,4 +6,9 @@ export const createSurvey = asyncWrap(async (req, res) => {
console.log("Survey body", survey);
const newSurvey = await surveyDb.createSurvey(survey);
return res.json(newSurvey);
});
\ No newline at end of file
});
// export const getSurveys = asyncWrap(async (req, res) => {
// const surveys = await surveyDb.getSurveys();
// return res.json(surveys);
// });
......@@ -3,4 +3,9 @@ import { Survey, ISurvey } from "../models";
export const createSurvey = async (survey: ISurvey) => {
const newSurvey = await Survey.create(survey);
return newSurvey;
};
\ No newline at end of file
};
// export const getSurveys = async () => {
// const surveys = await Survey.find({}).populate("questions")
// return surveys
// }
\ No newline at end of file
......@@ -7,4 +7,7 @@ router
.route("/create")
.post(surveyCtrl.createSurvey);
// router
// .route("/profile")
// .get(surveyCtrl.getSurveys)
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