From ee2c8c3ac7e83e6f13799c53371fcabdc4922da0 Mon Sep 17 00:00:00 2001 From: GC-Park Date: Thu, 21 Sep 2023 22:07:38 +0900 Subject: [PATCH] =?UTF-8?q?refactor:=20=ED=95=80=20=EB=82=B4=20=EC=A7=80?= =?UTF-8?q?=EB=8F=84=EC=97=90=20=EC=A0=80=EC=9E=A5=20=EA=B8=B0=EB=8A=A5=20?= =?UTF-8?q?=EC=97=90=EB=9F=AC=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/apiHooks/usePost.ts | 2 +- frontend/src/apis/postApi.ts | 2 +- .../components/ModalMyTopicList/addToMyTopicList.tsx | 12 +----------- 3 files changed, 3 insertions(+), 13 deletions(-) diff --git a/frontend/src/apiHooks/usePost.ts b/frontend/src/apiHooks/usePost.ts index 73e1f4ad..70cbda53 100644 --- a/frontend/src/apiHooks/usePost.ts +++ b/frontend/src/apiHooks/usePost.ts @@ -4,7 +4,7 @@ import { ContentTypeType } from '../types/Api'; interface fetchPostProps { url: string; - payload: {}; + payload?: {} | FormData; contentType?: ContentTypeType; errorMessage: string; onSuccess?: () => void; diff --git a/frontend/src/apis/postApi.ts b/frontend/src/apis/postApi.ts index f05dec3d..8df139ce 100644 --- a/frontend/src/apis/postApi.ts +++ b/frontend/src/apis/postApi.ts @@ -4,7 +4,7 @@ import withTokenRefresh from './utils'; export const postApi = async ( url: string, - payload: {} | FormData, + payload?: {} | FormData, contentType?: ContentTypeType, ) => { return await withTokenRefresh(async () => { diff --git a/frontend/src/components/ModalMyTopicList/addToMyTopicList.tsx b/frontend/src/components/ModalMyTopicList/addToMyTopicList.tsx index a62aa88f..7fb88f69 100644 --- a/frontend/src/components/ModalMyTopicList/addToMyTopicList.tsx +++ b/frontend/src/components/ModalMyTopicList/addToMyTopicList.tsx @@ -35,20 +35,10 @@ const AddToMyTopicList = ({ pin }: any) => { }, []); const addPinToTopic = async (topic: OnClickDesignatedProps) => { - const url = '/pins'; - const payload = { - topicId: topic.topicId, - name: pin.name, - description: pin.description, - address: pin.address, - latitude: pin.latitude, - longitude: pin.longitude, - legalDongCode: '', - }; + const url = `/topics/${topic.topicId}/copy?pinIds=${pin.id}`; fetchPost({ url, - payload, errorMessage: '내 지도에 핀 추가를 실패하였습니다. 잠시 후 다시 시도해주세요.', onSuccess: () => {