spotify api error parsing json
//mandatory to parse to JSON before posting the request
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;
};
Also in JavaScript:
- jquery get return jquery object
- Delete Properties from a JavaScript Object
- save or update mongoose
- promise catch javascript
- react clone element
- react native elements
- copy text to clipboard reactjs
- nodejs get file size
- javascript uppercase first character of each word
- how to compare a string with its ending in javascript
- extended class call method from super in javascript
- js array map
- how to hide a input and label jquery
- js is undefined or null
- js filter array of objects by value
- javascript subtract years from date
- hackerrank fizzbuzz javascript
- javascript check if text is overflowing
- how to remove backslash from string in javascript
- how to run node js on mac
- use bootstrap in react
- node js mongoose async await
- train function ajax
- javascript picture delete after time