Commit 287f9033 authored by Jiwon Yoon's avatar Jiwon Yoon
Browse files

질문수정확인, 홈화면 이미지

parent 343e8706
...@@ -19,7 +19,7 @@ export const AEssayForm = ({ element, answerQuestion }: AnswerProps) => { ...@@ -19,7 +19,7 @@ export const AEssayForm = ({ element, answerQuestion }: AnswerProps) => {
<div className="flex mt-3 w-full justify-center"> <div className="flex mt-3 w-full justify-center">
<input <input
type="text" type="text"
className="border w-11/12 h-36 my-3" className="border w-11/12 h-24 my-3"
id={element._id} id={element._id}
onChange={handleChange} onChange={handleChange}
value={answer} value={answer}
......
import React, { FormEvent } from "react"; import React, { FormEvent } from "react";
import { useAuth } from "../auth/auth.context"; import { useAuth } from "../auth/auth.context";
import SurveyImg from "../icons/surveyimg.png"; import homeImg from "../icons/homeImg.png";
export const Home = () => { export const Home = () => {
const { user } = useAuth(); const { user } = useAuth();
...@@ -30,10 +30,10 @@ export const Home = () => { ...@@ -30,10 +30,10 @@ export const Home = () => {
+ +
</button> </button>
</div> </div>
<p className="text-center text-xl text-black mt-3">Create now!</p> <p className="text-center text-xl text-black my-3">Create now!</p>
</div> </div>
<div className="flex justify-center mt-3"> <div className="flex mt-5 md:px-48 bg-themeColor">
<img src={SurveyImg} className="object-scale-down justify-center" /> <img src={homeImg} className="m-3" />
</div> </div>
</div> </div>
); );
......
...@@ -77,17 +77,22 @@ export const CreateSurvey = () => { ...@@ -77,17 +77,22 @@ export const CreateSurvey = () => {
async function handleSubmit(event: FormEvent) { async function handleSubmit(event: FormEvent) {
event.preventDefault(); event.preventDefault();
try { const notEditComplete = isEditing?.find((el) => el.isEditing);
const newSurvey: SurveyType = await surveyApi.editSurvey(survey); if (notEditComplete) {
console.log(newSurvey); alert("아직 수정이 완료되지 않은 질문이 존재합니다.");
setSuccess(true); } else {
alert("저장되었습니다"); try {
navigate("/profile"); const newSurvey: SurveyType = await surveyApi.editSurvey(survey);
setError(""); console.log(newSurvey);
} catch (error) { setSuccess(true);
catchErrors(error, setError); alert("저장되었습니다");
} finally { navigate("/profile");
setLoading(false); setError("");
} catch (error) {
catchErrors(error, setError);
} finally {
setLoading(false);
}
} }
} }
......
...@@ -79,17 +79,22 @@ export const EditSurvey = () => { ...@@ -79,17 +79,22 @@ export const EditSurvey = () => {
async function handleSubmit(event: FormEvent) { async function handleSubmit(event: FormEvent) {
event.preventDefault(); event.preventDefault();
try { const notEditComplete = isEditing?.find((el) => el.isEditing);
const newSurvey: SurveyType = await surveyApi.editSurvey(survey); if (notEditComplete) {
console.log(newSurvey); alert("아직 수정이 완료되지 않은 질문이 존재합니다.");
setSuccess(true); } else {
alert("저장되었습니다"); try {
navigate("/profile"); const newSurvey: SurveyType = await surveyApi.editSurvey(survey);
setError(""); console.log(newSurvey);
} catch (error) { setSuccess(true);
catchErrors(error, setError); alert("저장되었습니다");
} finally { navigate("/profile");
setLoading(false); setError("");
} catch (error) {
catchErrors(error, setError);
} finally {
setLoading(false);
}
} }
} }
......
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