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