From 5202bbbe823a1c560fe13fc04fe4fa165252d275 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9E=A5=EB=8F=99=EA=B7=A0?= <57230590+dongkyun-dev@users.noreply.github.com> Date: Sun, 18 Feb 2024 17:05:31 +0900 Subject: [PATCH] =?UTF-8?q?[bug/BAR-237]=20=EC=A4=91=EB=B3=B5=20=ED=8F=B4?= =?UTF-8?q?=EB=8D=94=EB=AA=85=EC=97=90=20=EB=8C=80=ED=95=9C=20=EC=97=90?= =?UTF-8?q?=EB=9F=AC=20=ED=95=B8=EB=93=A4=EB=A7=81=20(#67)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: mutateAsync => mutate 사용으로 변경 * feat: async 제거 및 EditFolder에서도 mutate 함수 사용 반영 --- src/components/Modal/modals/EditFolder.tsx | 8 ++++---- src/components/Modal/modals/MakeFolder.tsx | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/Modal/modals/EditFolder.tsx b/src/components/Modal/modals/EditFolder.tsx index 68aba01c..162fc896 100644 --- a/src/components/Modal/modals/EditFolder.tsx +++ b/src/components/Modal/modals/EditFolder.tsx @@ -20,7 +20,7 @@ const EditFolder = () => { const [value, setValue] = useState(folderName); const [errorMessage, setErrorMessage] = useState(''); - const { mutateAsync } = useUpdateMemoFolder(); + const { mutate } = useUpdateMemoFolder(); const handleInputChange = (e: ChangeEvent) => { setErrorMessage(''); @@ -30,11 +30,11 @@ const EditFolder = () => { const handleFolderNameEdit = async () => { if (value.length > 10) return setErrorMessage('10자 내로 입력해주세요!'); - await mutateAsync( + mutate( { memoFolderId, folderName: value }, { - onSuccess: async () => { - await queryClient.invalidateQueries({ + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['memo-folders'], }); closeModal(); diff --git a/src/components/Modal/modals/MakeFolder.tsx b/src/components/Modal/modals/MakeFolder.tsx index be1f18ae..76f2956f 100644 --- a/src/components/Modal/modals/MakeFolder.tsx +++ b/src/components/Modal/modals/MakeFolder.tsx @@ -19,7 +19,7 @@ const MakeFolder = () => { const [value, setValue] = useState(''); const [errorMessage, setErrorMessage] = useState(''); - const { mutateAsync } = usePostMemoFolders(); + const { mutate } = usePostMemoFolders(); const handleInputChange = (e: ChangeEvent) => { setErrorMessage(''); @@ -29,9 +29,9 @@ const MakeFolder = () => { const handle만들기Click = async () => { if (value.length > 10) return setErrorMessage('10자 내로 입력해주세요!'); - await mutateAsync(value, { - onSuccess: async () => { - await queryClient.invalidateQueries({ + mutate(value, { + onSuccess: () => { + queryClient.invalidateQueries({ queryKey: ['memo-folders'], }); closeModal();