추가 api
Web API Reference | Spotify for Developers
The position to insert the items, a zero-based index. For example, to insert the items in the first position: position=0 ; to insert the items in the third position: position=2. If omitted, the items will be appended to the playlist. Items are added in the
developer.spotify.com
import { useMutation } from "@tanstack/react-query"
interface AddPlaylistVariables {
playlist_id: string;
uris: string[];
position?: number; // 삽입 위치 (선택 사항)
// 알림창에 표시할 트랙 정보
trackName?: string;
albumName?: string;
}
const useAddPlaylist = () => {
return useMutation({
});
}
export default useAddPlaylist

//API
export const AddPlaylist =
async( playlist_id: string, items: AddPlaylistRequest)
: Promise<AddPlaylistResponse> => {
try {
const response = await api.post(`/playlists/${playlist_id}/tracks`, items);
return response.data;
}catch (error) {
console.error(`플레이리스트 ${playlist_id}에 항목 추가 실패:`, error);
throw error;
}
}
spotity_pe/src/hooks/useAddPlaylist.ts at master · roseraph502on/spotity_pe
Contribute to roseraph502on/spotity_pe development by creating an account on GitHub.
github.com
