Skip to content

Commit

Permalink
fix: Invalidate queries수정, 이미지 수정 반영
Browse files Browse the repository at this point in the history
  • Loading branch information
se0jinYoon committed Nov 12, 2024
1 parent 28d991c commit 0671e8b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 4 additions & 2 deletions src/pages/postPage/PostPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -339,9 +339,11 @@ const PostPage = () => {
return;
} else {
try {
await handleImageUpload(url, fileName, imageFile, editorVal.imageUrl);
const imgUrl = await handleImageUpload(url, fileName, imageFile, editorVal.imageUrl);
if (imgUrl) {
putEditContent(imgUrl);
}

putEditContent();
handleShowModal();
setEditorModalType('editContent');
editorFlowModalDispatch({ type: 'editContent' });
Expand Down
6 changes: 2 additions & 4 deletions src/pages/postPage/hooks/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ export const useGetEditPostContent = (postId: string, isEditView: boolean) => {
queryKey: [QUERY_KEY_POST.getEditPostContent, postId, isEditView],
queryFn: () => fetchEditPostContent(postId),
enabled: !!isEditView,
staleTime: 0,
});

const editPostTopicList = data && data?.data?.topicList;
Expand Down Expand Up @@ -167,7 +166,6 @@ export const usePutEditContent = ({
topicId,
title,
content,
imageUrl,
anonymous,
postId,
contentWithoutTag,
Expand All @@ -181,14 +179,13 @@ export const usePutEditContent = ({
topicId,
title,
content,
imageUrl,
anonymous,
postId,
contentWithoutTag,
setPostErrorMessage,
},
],
mutationFn: () =>
mutationFn: (imageUrl: string) =>
editPutContent({
topicId,
title,
Expand All @@ -201,6 +198,7 @@ export const usePutEditContent = ({
}),
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: [QUERY_KEY_POST_DETAIL.getPostDetail, postId] });
queryClient.invalidateQueries({ queryKey: [QUERY_KEY_POST.getEditPostContent, postId] });
},
});
return data;
Expand Down

0 comments on commit 0671e8b

Please sign in to comment.