Skip to content

Commit

Permalink
fix: conflict 해결
Browse files Browse the repository at this point in the history
  • Loading branch information
wogha95 committed Jun 22, 2022
1 parent 972be1b commit 02dff6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/pages/ChallengePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const ChallengePage = () => {
const [endDate, setEndDate] = useState("");
const [isCheered, setIsCheered] = useState(false);
const [cheerUpId, setCheerUpId] = useState("");
const [authorId, setAuthorId] = useState("");
const [show, setShow] = useState(false);

const [, , channelId, postId] = window.location.pathname.split("/");
Expand All @@ -50,6 +51,7 @@ const ChallengePage = () => {
new Date(format(new Date(), "yyyy-MM-dd")),
new Date(date)
);
setAuthorId(author._id);
validateGuest(author._id);
setReward(reward);
setCommentCount(comments.length);
Expand Down Expand Up @@ -115,15 +117,15 @@ const ChallengePage = () => {
status === 200 ? setCheerUpYes(data._id) : alert("다시 시도바랍니다.");
}
} else {
alert("로그인 후 이용가능합니다.");
alert("로그인 후 이용가능합니다!");
}
};

const onCheerUpNotificationEvent = async (cheerUpId) => {
const { status } = await fetchPostNotification({
notificationType: "LIKE",
notificationTypeId: cheerUpId,
userId: myUser._id,
userId: authorId,
});
status === 200
? console.log("success like-notification")
Expand Down
6 changes: 4 additions & 2 deletions src/pages/CommentPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,16 @@ const CommentPage = () => {
const [myUser] = useAtom(userAtom);
const [commentList, setCommentList] = useState([]);
const [commentValue, setCommentValue] = useState("");
const [authorId, setAuthorId] = useState("");
const [show, setShow] = useState(false);

const [, , , postId] = window.location.pathname.split("/");
const { data: Contents } = useGetChallenge(postId);

useEffect(() => {
if (Contents?.status === 200) {
const { comments } = Contents?.data;
const { author, comments } = Contents?.data;
setAuthorId(author._id);
setCommentList(comments);
setShow(true);
}
Expand All @@ -42,7 +44,7 @@ const CommentPage = () => {
const { status } = await fetchPostNotification({
notificationType: "COMMENT",
notificationTypeId: commentId,
userId: myUser._id,
userId: authorId,
});
status === 200
? console.log("success comment-notification")
Expand Down

0 comments on commit 02dff6e

Please sign in to comment.