Helper Function

Quick copy-paste JavaScript function for API calls:

async function postData(url = '', data = {}, jwt) {
  const response = await fetch(url, {
    method: 'POST',
    headers: { 
      'Content-Type': 'application/json', 
      'Authorization': 'Bearer ' + jwt 

    },

    body: JSON.stringify(data)
  });
    console.log(response)
return response.json();
}

Use this in browser dev tools or Node.js to quickly test requests.