Skip to content

Commit cc4db70

Browse files
committed
Merge branch 'feat/#87/toast' into dev
2 parents de6ea6b + fb5eea3 commit cc4db70

4 files changed

Lines changed: 19 additions & 12 deletions

File tree

β€Žsrc/features/chatList/api/usePatchExit.tsβ€Ž

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { useToast } from '@/common/hooks/useToast';
12
import client from '@/common/utils/client';
23
import { QUERY_KEYS } from '@/libs/queryKeys';
34
import { useMutation, useQueryClient } from '@tanstack/react-query';
@@ -17,16 +18,18 @@ const patchExit = async (chatRoomId: number) => {
1718

1819
export const usePatchExit = () => {
1920
const queryClient = useQueryClient();
21+
const { openToast } = useToast();
2022

2123
return useMutation<ExitResponse, AxiosError<ExitResponse>, number, unknown>({
2224
mutationFn: (chatRoomId: number) => patchExit(chatRoomId),
2325
retry: 0,
2426
onSuccess: () => {
2527
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.CHAT_LIST] });
26-
console.log('퇴μž₯ 성곡');
28+
openToast({ message: 'μ±„νŒ…λ°©μ—μ„œ 퇴μž₯ν–ˆμ–΄μš”' });
2729
},
28-
onError: error => {
29-
console.error('퇴μž₯ μ‹€νŒ¨', error);
30+
onError: () => {
31+
openToast({ message: '퇴μž₯에 μ‹€νŒ¨ν–ˆμ–΄μš”. λ‹€μ‹œ μ‹œλ„ν•΄μ£Όμ„Έμš”!' });
32+
// console.error('퇴μž₯ μ‹€νŒ¨', error);
3033
},
3134
});
3235
};

β€Žsrc/features/myEdit/apis/usePutUser.tsβ€Ž

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { s3PutImageToUrl } from '@/common/apis/s3PutImageToUrl';
2+
import { useToast } from '@/common/hooks/useToast';
23
import client from '@/common/utils/client';
34
import { QUERY_KEYS } from '@/libs/queryKeys';
45
import type { Gender, UserInterface } from '@/libs/types/user';
@@ -31,14 +32,15 @@ const putUser = async ({ userData, fileData }: { userData: UserPayload; fileData
3132

3233
export const usePutUser = () => {
3334
const queryClient = useQueryClient();
35+
const { openToast } = useToast();
3436

3537
return useMutation({
3638
mutationFn: putUser,
3739
onSuccess: () => {
3840
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.USER] });
3941
},
40-
onError: error => {
41-
console.error('μœ μ € 정보 μˆ˜μ • μ‹€νŒ¨', error);
42+
onError: () => {
43+
openToast({ message: 'μœ μ € 정보 μˆ˜μ •μ— μ‹€νŒ¨ν–ˆμ–΄μš”. λ‹€μ‹œ μ‹œλ„ν•΄μ£Όμ„Έμš”!' });
4244
},
4345
});
4446
};

β€Žsrc/pages/EditPickPage/index.tsxβ€Ž

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ const EditPickPage = () => {
9999
onSuccess: () => {
100100
navigate(-1);
101101
},
102-
onError: error => {
103-
alert(error.message);
102+
onError: () => {
103+
openToast({ message: 'PICK μˆ˜μ •μ— μ‹€νŒ¨ν–ˆμ–΄μš”. λ‹€μ‹œ μ‹œλ„ν•΄μ£Όμ„Έμš”!' });
104104
},
105105
},
106106
);
@@ -120,8 +120,8 @@ const EditPickPage = () => {
120120
onSuccess: () => {
121121
navigate(-1);
122122
},
123-
onError: error => {
124-
alert(error.message);
123+
onError: () => {
124+
openToast({ message: 'PICK μˆ˜μ •μ— μ‹€νŒ¨ν–ˆμ–΄μš”. λ‹€μ‹œ μ‹œλ„ν•΄μ£Όμ„Έμš”!' });
125125
},
126126
},
127127
);

β€Žsrc/pages/PostPickPage/index.tsxβ€Ž

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ const PostPickPage = () => {
7373
onSuccess: response => {
7474
navigate(`/pick-detail/${response.currentAppointment.appointment.appointmentId}`, { replace: true });
7575
},
76-
onError: error => {
77-
alert(error.message);
76+
onError: () => {
77+
openToast({ message: 'PICK 생성에 μ‹€νŒ¨ν–ˆμ–΄μš”. λ‹€μ‹œ μ‹œλ„ν•΄μ£Όμ„Έμš”!' });
7878
},
7979
},
8080
);
@@ -93,7 +93,9 @@ const PostPickPage = () => {
9393
onSuccess: response => {
9494
navigate(`/pick-detail/${response.currentAppointment.appointment.appointmentId}`, { replace: true });
9595
},
96-
onError: error => alert(error.message),
96+
onError: () => {
97+
openToast({ message: 'PICK 생성에 μ‹€νŒ¨ν–ˆμ–΄μš”. λ‹€μ‹œ μ‹œλ„ν•΄μ£Όμ„Έμš”!' });
98+
},
9799
},
98100
);
99101
};

0 commit comments

Comments
Β (0)