Skip to content

Commit

Permalink
fix: (#801) 공지사항 생성, 수정, 삭제 시 캐시 초기화 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
Gilpop8663 committed Oct 19, 2023
1 parent 43f0fe5 commit cfcbebf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion frontend/src/hooks/query/notice/useCreateNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ export const useCreateNotice = () => {
(notice: NoticeRequest) => createNotice(notice),
{
onSuccess: () => {
queryClient.invalidateQueries([QUERY_KEY.NOTICE]);
queryClient.invalidateQueries({
predicate: ({ queryKey }) => queryKey[0] === QUERY_KEY.NOTICE,
});
},
onError: error => {
const errorMessage =
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/hooks/query/notice/useDeleteNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ export const useDeleteNotice = () => {
(noticeId: number) => deleteNotice(noticeId),
{
onSuccess: () => {
queryClient.invalidateQueries([QUERY_KEY.NOTICE]);
queryClient.invalidateQueries({
predicate: ({ queryKey }) => queryKey[0] === QUERY_KEY.NOTICE,
});
},
onError: error => {
const errorMessage =
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/hooks/query/notice/useModifyNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ export const useModifyNotice = () => {
modifyNotice({ notice, noticeId }),
{
onSuccess: () => {
queryClient.invalidateQueries([QUERY_KEY.NOTICE]);
queryClient.invalidateQueries({
predicate: ({ queryKey }) => queryKey[0] === QUERY_KEY.NOTICE,
});
},
onError: error => {
const errorMessage =
Expand Down

0 comments on commit cfcbebf

Please sign in to comment.