Skip to content

Commit

Permalink
[bug/BAR-237] 중복 폴더명에 대한 에러 핸들링 (#67)
Browse files Browse the repository at this point in the history
* fix: mutateAsync => mutate 사용으로 변경

* feat: async 제거 및 EditFolder에서도 mutate 함수 사용 반영
  • Loading branch information
miro-ring authored Feb 18, 2024
1 parent d571cab commit 5202bbb
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions src/components/Modal/modals/EditFolder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<HTMLInputElement>) => {
setErrorMessage('');
Expand All @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/components/Modal/modals/MakeFolder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const MakeFolder = () => {
const [value, setValue] = useState('');
const [errorMessage, setErrorMessage] = useState('');

const { mutateAsync } = usePostMemoFolders();
const { mutate } = usePostMemoFolders();

const handleInputChange = (e: ChangeEvent<HTMLInputElement>) => {
setErrorMessage('');
Expand All @@ -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();
Expand Down

0 comments on commit 5202bbb

Please sign in to comment.