How can I console log the response once my post request is success. My response is only giving me an empty object. Below is my code:
try {
const formData = new FormData() const endpoint = `***` // Get data from the form. const data = { title: 'test name', } formData.append('data', JSON.stringify(data)); const options = { method: 'POST', headers: { 'Authorization': `Bearer ${process.env.NEXT_PUBLIC_API_TOKEN}` }, body: formData } const response = await fetch(endpoint, options) if (response.ok) { console.log('OK Response: '+JSON.stringify.json()); } } catch (error) { console.log(error); }