Commit 88e6bd35 authored by jang dong hyeok's avatar jang dong hyeok
Browse files

.

parent 036ec8c6
...@@ -18,11 +18,11 @@ export const SurveyRouter = () => { ...@@ -18,11 +18,11 @@ export const SurveyRouter = () => {
<Route index element={<Home />} /> <Route index element={<Home />} />
<Route path="login" element={<Login />} /> <Route path="login" element={<Login />} />
<Route path="signup" element={<SignUp />} /> <Route path="signup" element={<SignUp />} />
<Route path="surveys/edit/" element={<EditResultButton />}> <Route path="surveys/:surveyId/" element={<EditResultButton />}>
<Route path=":surveyId" element={<EditSurvey />} /> <Route path="edit" element={<EditSurvey />} />
<Route path=":surveyId/result" element={<ResultSurvey />} /> <Route path="result" element={<ResultSurvey />} />
</Route> </Route>
<Route path="surveys/:surveyId" element={<AnswerSurveyForm />} /> <Route path="survey/:surveyId" element={<AnswerSurveyForm />} />
<Route <Route
path="profile" path="profile"
element={ element={
......
...@@ -9,13 +9,13 @@ export const Header = () => { ...@@ -9,13 +9,13 @@ export const Header = () => {
return ( return (
<div className="bg-white border-b-2 border-b-themeColor px-2 sm:px-4 py-2.5"> <div className="bg-white border-b-2 border-b-themeColor px-2 sm:px-4 py-2.5">
<div className="container flex flex-wrap justify-between items-center mx-auto"> <div className="container flex flex-col md:flex-row flex-wrap justify-between items-center mx-auto">
<Link to="/" className="font-bold text-2xl text-themeColor"> <Link to="/" className="font-bold text-2xl text-themeColor">
Simple Survey Form Simple Survey Form
</Link> </Link>
<div className="md:flex items-center justify-end md:flex-1 lg:w-0"> <div className="md:flex items-center justify-end md:flex-1 lg:w-0">
{user.isLoggedIn ? ( {user.isLoggedIn ? (
<div> <div className="pt-2">
<button <button
onClick={() => logout(() => navigate("/"))} onClick={() => logout(() => navigate("/"))}
className="font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md" className="font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md"
...@@ -29,7 +29,7 @@ export const Header = () => { ...@@ -29,7 +29,7 @@ export const Header = () => {
</Link> </Link>
</div> </div>
) : ( ) : (
<div> <div className="pt-2">
<Link to="/login"> <Link to="/login">
<button className="font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md"> <button className="font-bold text-gray-600 hover:text-themeColor mx-1 py-2 px-3 rounded-md">
로그인 로그인
......
...@@ -16,7 +16,7 @@ export const Home = () => { ...@@ -16,7 +16,7 @@ export const Home = () => {
return ( return (
<div className="flex flex-col place-items-center"> <div className="flex flex-col place-items-center">
<div className="justify-end text-center text-3xl text-black h-16 mt-12"> <div className="justify-end text-center text-2xl md:text-3xl text-black h-16 mt-12">
가장 쉽게 설문지를 만드세요! 가장 쉽게 설문지를 만드세요!
</div> </div>
<div className="flex flex-col place-items-center container"> <div className="flex flex-col place-items-center container">
......
...@@ -16,7 +16,7 @@ export const MySurveyCard = ({ data }: Props) => { ...@@ -16,7 +16,7 @@ export const MySurveyCard = ({ data }: Props) => {
const [success, setSuccess] = useState(false); const [success, setSuccess] = useState(false);
const editSurvey = () => { const editSurvey = () => {
navigate(`/surveys/edit/${data._id}`, { navigate(`/surveys/${data._id}/edit`, {
replace: true, replace: true,
state: { save: true }, state: { save: true },
}); });
......
...@@ -21,7 +21,7 @@ export const Profile = () => { ...@@ -21,7 +21,7 @@ export const Profile = () => {
async function createSurvey() { async function createSurvey() {
const newSurvey: SurveyType = await surveyApi.createSurvey(survey); const newSurvey: SurveyType = await surveyApi.createSurvey(survey);
navigate(`/surveys/edit/${newSurvey._id}`, { navigate(`/surveys/${newSurvey._id}/edit`, {
replace: true, replace: true,
}); });
} }
...@@ -36,7 +36,6 @@ export const Profile = () => { ...@@ -36,7 +36,6 @@ export const Profile = () => {
return ( return (
<div className="flex flex-col items-center"> <div className="flex flex-col items-center">
<div className="mt-10 text-xl font-bold">나의 설문조사</div> <div className="mt-10 text-xl font-bold">나의 설문조사</div>
<img src={`${baseImageUrl}/9e24ad36a2947b08c89913b01`} />
<div className="grid grid-cols-1 md:grid-cols-4 sm:grid-cols-2 gap-4 mt-6"> <div className="grid grid-cols-1 md:grid-cols-4 sm:grid-cols-2 gap-4 mt-6">
<button <button
onClick={createSurvey} onClick={createSurvey}
......
...@@ -156,7 +156,7 @@ export const Question = ({ ...@@ -156,7 +156,7 @@ export const Question = ({
onChange={handleSelect} onChange={handleSelect}
disabled={save} disabled={save}
value={element.type} value={element.type}
className="w-36 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-themeColor w-full mr-3 p-2.5" className="w-32 md:w-36 bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-themeColor w-full mr-3 p-2.5"
> >
{Array.from(QUESTION_TYPES.entries()).map(([key, value]) => ( {Array.from(QUESTION_TYPES.entries()).map(([key, value]) => (
<option <option
......
...@@ -17,7 +17,7 @@ export const EditResultButton = () => { ...@@ -17,7 +17,7 @@ export const EditResultButton = () => {
<div> <div>
<div className="flex place-content-center mt-6"> <div className="flex place-content-center mt-6">
<NavLink <NavLink
to={`/surveys/edit/${surveyId}`} to={`/surveys/${surveyId}/edit`}
style={({ isActive }) => style={({ isActive }) =>
isActive isActive
? { ? {
...@@ -33,7 +33,7 @@ export const EditResultButton = () => { ...@@ -33,7 +33,7 @@ export const EditResultButton = () => {
<div className="text-xl m-3 ">설문지 수정</div> <div className="text-xl m-3 ">설문지 수정</div>
</NavLink> </NavLink>
<NavLink <NavLink
to={`/surveys/edit/${surveyId}/result`} to={`/surveys/${surveyId}/result`}
style={({ isActive }) => style={({ isActive }) =>
isActive isActive
? { ? {
......
...@@ -14,6 +14,7 @@ export const createSurvey = asyncWrap( ...@@ -14,6 +14,7 @@ export const createSurvey = asyncWrap(
let survey = req.body; let survey = req.body;
survey.user = userId; survey.user = userId;
console.log("survey body", survey); console.log("survey body", survey);
delete survey._id;
const newSurvey = await surveyDb.createSurvey(survey); const newSurvey = await surveyDb.createSurvey(survey);
return res.json(newSurvey); return res.json(newSurvey);
} }
......
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