Skip to content

Commit

Permalink
Merge pull request #87 from Likelion-HongikUniv/feature/myPage/choyeon2e
Browse files Browse the repository at this point in the history
hotfix: delete시 생기는 오류 fix
  • Loading branch information
choyeon2e authored Mar 29, 2023
2 parents 0e8a37b + 9f985e5 commit 3103f4f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 2 additions & 0 deletions src/api/deletePost.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import client from "./client";
import { useMutation, UseMutationResult } from "@tanstack/react-query";

const token = localStorage.getItem("token");

async function deletePost(postId: number): Promise<void> {
Expand All @@ -22,6 +23,7 @@ async function deletePost(postId: number): Promise<void> {
})
.then((response) => {
alert("🦁 글이 삭제되었습니다 🦁");
window.location.reload();
});
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/postPage/MoreButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function MoreButton({ id, isBoard, isComment }: MoreButtonProps) {
const onClickDelete = () => {
if (isBoard) {
handleDeletePost(id);
window.location.replace(`/community/BOARD`);
navigate(`/community/BOARD`);
} else if (isComment) {
handleDeleteComment(id);
} else {
Expand Down
8 changes: 2 additions & 6 deletions src/pages/WritingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export function WritingPage() {
const selectedMainCategory = state.category;
const [clickedMainCategory, setClickedMainCategory] = useState(selectedMainCategory);
const [clickedSubCategory, setClickedSubCategory] = useState(selectedSubCategory.key);
const title = useInput(""); // title.value가 값임
const title = useInput(state.title); // title.value가 값임

return (
<>
Expand All @@ -46,11 +46,7 @@ export function WritingPage() {
clickedSubCategory={clickedSubCategory}
setClickedSubCategory={setClickedSubCategory}
/>
{state ? (
<InputBar style={{ marginTop: "60px" }} {...title} value={state.title} />
) : (
<InputBar style={{ marginTop: "60px" }} {...title} />
)}
<InputBar style={{ marginTop: "60px" }} {...title} />
<TextEditor title={title.value} mainCategory={clickedMainCategory} subCategory={clickedSubCategory} />
{isCancelButtonClicked && <ConfirmationPopup />}
{isThumbnailSetButtonClicked && <ThumbnailUploadPopup />}
Expand Down

0 comments on commit 3103f4f

Please sign in to comment.