Skip to content

Commit

Permalink
fix: 알림 삭제 array형으로 업데이트
Browse files Browse the repository at this point in the history
  • Loading branch information
ww8007 committed Oct 21, 2023
1 parent b6af9db commit 669c74e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
18 changes: 9 additions & 9 deletions src/notification/api/notification.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
import client from '@/common/service/client';
import useToast from '@/common-ui/Toast/hooks/useToast';
import qs from 'qs';
import dayjs from 'dayjs';
import 'dayjs/locale/ko';
dayjs.locale('ko');
Expand Down Expand Up @@ -115,27 +116,26 @@ export const usePATCHNotificationReadQuery = ({
};

interface DELETENotificationRequest {
notificationId: number;
token?: string;
notificationIds: string[];
memberId: number;
}

const deleteNotificationAPI = async ({
notificationId,
token,
memberId,
notificationIds,
}: DELETENotificationRequest) => {
const { data } = await client({
method: 'delete',
url: `/notifications/${notificationId}`,
params: { notificationId },
data: {},
headers: token ? { Authorization: `Bearer ${token}` } : {},
url: `/members/${memberId}/notifications/selected`,
params: { notificationIds },
paramsSerializer: (params) =>
qs.stringify(params, { arrayFormat: 'repeat' }),
});
return data;
};

export interface DELETENotificationQueryRequest {
memberId: number;
token?: string;
}
export const useDELETENotificationQuery = ({
memberId,
Expand Down
3 changes: 2 additions & 1 deletion src/pages/NotificationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ const NotificationPage = () => {
// NOTE : 임시로 하나씩 삭제 call
if (mode === 'DELETE') {
await mutateDeleteCategory({
notificationId: Number(deleteCategoryList[0]),
memberId,
notificationIds: deleteCategoryList,
});
}
if (mode === 'DELETE_ALL') {
Expand Down

0 comments on commit 669c74e

Please sign in to comment.