From 038bba46e962a82cd1e76370b6c9b00c8658178b Mon Sep 17 00:00:00 2001 From: ww8007 Date: Sat, 21 Oct 2023 22:18:12 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=95=8C=EB=A6=BC=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=20array=ED=98=95=EC=9C=BC=EB=A1=9C=20=EC=97=85=EB=8D=B0?= =?UTF-8?q?=EC=9D=B4=ED=8A=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/notification/api/notification.ts | 18 +++++++++--------- src/pages/NotificationPage.tsx | 3 ++- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/notification/api/notification.ts b/src/notification/api/notification.ts index 1f8a967a..d3680901 100644 --- a/src/notification/api/notification.ts +++ b/src/notification/api/notification.ts @@ -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'); @@ -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, diff --git a/src/pages/NotificationPage.tsx b/src/pages/NotificationPage.tsx index a65da5a0..b5fc11b9 100644 --- a/src/pages/NotificationPage.tsx +++ b/src/pages/NotificationPage.tsx @@ -48,7 +48,8 @@ const NotificationPage = () => { // NOTE : 임시로 하나씩 삭제 call if (mode === 'DELETE') { await mutateDeleteCategory({ - notificationId: Number(deleteCategoryList[0]), + memberId, + notificationIds: deleteCategoryList, }); } if (mode === 'DELETE_ALL') {