api error parsing json code example
Example: spotify api error parsing json
const getPlaylistId = async (playlistName) => {
const userId = await getUserId();
const body = JSON.stringify({
name: playlistName,
});
const responseCreatedPlaylist = await fetch(
`https://cors-anywhere.herokuapp.com/${baseUrl}/users/${userId}/playlists`,
{
method: "POST",
headers: {
"Authorization": `Bearer ${accessToken}`,
"Content-Type":
"application/json"
},
body,
}
);
const { id } = await responseCreatedPlaylist.json();
return id;
};