Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ejPark43 committed Aug 5, 2024
2 parents 3ecd6dd + b75ffdc commit 1ed4089
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
1 change: 1 addition & 0 deletions src/_redirects
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/* /index.html 200
2 changes: 1 addition & 1 deletion src/diaryWritePage/components/DiaryWrite.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function DiaryWrite() {
setThumbnailModal(true);
};
useEffect(() => {
console.log("formData updated:", formData, csrfToken);
console.log("formData updated:", formData, csrfToken, goalId);
}, [formData]);

return (
Expand Down
22 changes: 5 additions & 17 deletions src/diaryWritePage/components/ThumbnailModal.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,7 @@ import styled from "styled-components";
import CloseRoundedIcon from "@mui/icons-material/CloseRounded";
import AddRoundedIcon from "@mui/icons-material/AddRounded";
import createDiary from "../../apis/createDiary";
function ThumbnailModal({
setThumbnailModal,
setEditedModal,
formData,
diaryDetail,
csrfToken,
}) {
function ThumbnailModal({ setThumbnailModal, setPostedModal, formData, goalId, csrfToken }) {
// 이미지 설정//
const fileInputRef = useRef(null);
const [previewUrl, setPreviewUrl] = useState(null); // 미리보기창에 들어갈 이미지 url
Expand All @@ -24,8 +18,7 @@ function ThumbnailModal({
};
const handleNextStep = async () => {
//
setThumbnailModal(false);
setEditedModal(true);
// setPostedModal(true);
// ^^^^^^ 나중에 이 부분 지우기

// *** 이 함수 안에서 수정된 일지를 백엔드로 submit할 필요 있음 (내용 + 대표사진) *** //
Expand All @@ -44,9 +37,9 @@ function ThumbnailModal({
}
// TODO: 다이어리 수정하는 api 파일 생성하기 !!!!!! creatDiary말고 나중에
// 백엔드에서 일지 수정 api 생성하면 만들고 이 부분도 고치기.
await createDiary(formDataToSend, csrfToken, diaryDetail);
await createDiary(formDataToSend, csrfToken, goalId);
setThumbnailModal(false);
setEditedModal(true);
setPostedModal(true);
} catch (error) {
console.error("일지 생성 실패", error);
}
Expand Down Expand Up @@ -95,12 +88,7 @@ function ThumbnailModal({
<div className="image-add-text">사진 추가하기</div>
</>
)}
<input
type="file"
style={{ display: "none" }}
onChange={handleFileInputChange}
ref={fileInputRef}
/>
<input type="file" style={{ display: "none" }} onChange={handleFileInputChange} ref={fileInputRef} />
</ImageAdd>
<Buttons>
<NextBtn>
Expand Down

0 comments on commit 1ed4089

Please sign in to comment.