From 8bb3f1b3c4d394442fbbcf9b3abe2f01d4f550b0 Mon Sep 17 00:00:00 2001 From: PARKGEONTAE <112490505+prkgnt@users.noreply.github.com> Date: Tue, 14 Jan 2025 14:34:48 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=B6=81=EB=A7=88=ED=81=AC=20=EC=83=9D?= =?UTF-8?q?=EC=84=B1=20api=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/_utils/api.ts | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/src/app/_utils/api.ts b/src/app/_utils/api.ts index e01a6ef..72a4280 100644 --- a/src/app/_utils/api.ts +++ b/src/app/_utils/api.ts @@ -247,7 +247,7 @@ const createGroup = async (groupName: string, access_token: string) => { return data; }; -const saveContentToGroup = async ( +const saveContentToGroup_Deprecated = async ( groupName: string | null, contentId: string | null, access_token: string @@ -274,6 +274,29 @@ const saveContentToGroup = async ( return data; }; +const saveContentToGroup = async ( + groupName: string | null, + contentId: string | null, + access_token: string +) => { + fetchUrl.pathname = `/api/bookmark/v1/groups/${groupName}/contents/${contentId}`; + + const data = await fetch(fetchUrl.href, { + method: "PUT", + headers: { + "Content-Type": "application/json;charset=UTF-8", + Accept: "application/json", + Authorization: `Bearer ${access_token}`, + }, + }); + + if (!data.ok) { + throw new Error("API Error"); + } + + return data; +}; + const getContentListInGroup = async ( groupName: string, access_token: string