function saveNote(note) {
  return fetch('/api/notes', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(note),
  })
  .then((res) => res.json())
  .then((data) => {
    console.log('Successful POST request:', data);
  
  return data
  })
  .catch((error) => {
    console.log(`Error on post request ${error}`)
  });
}
// posting one note that the user wrote
posting one note that the user wrote
posting one note that the user wrote
function saveNote(note) {
  return fetch('/api/notes', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(note),
  })
  .then((res) => res.json())
  .then((data) => {
    console.log('Successful POST request:', data);
  return data
  })
  .catch((error) => {
    console.log(`Error on post request ${error}`)
  });
}
function saveNote ( note ) { return fetch ( '/api/notes' , { method : 'POST' , headers : { 'Content-Type' : 'application/json' , } , body : JSON . stringify ( note ) , } ) . then ( ( res ) => res . json ( ) ) . then ( ( data ) => { console . log ( 'Successful POST request:' , data ) ; return data } ) . catch ( ( error ) => { console . log ( ` ${ error } ` ) } ) ; }
posting one note that the user wrote
posting one note that the user wrote