portfolio/src/main/webapp/comments.js
// creates a button that will delete given comment on click
creates a button that will delete given comment on click
creates a button that will delete given comment on click
function createDeleteButton(comment) {
  const deleteButton = document.createElement('button');
  deleteButton.innerText = 'Delete';
  deleteButton.onclick = function() {
    const request = new Request('/delete-data?commentKey=' + comment.key, {
      method : 'POST',
    });
    fetch(request).then(() => {
      window.location.reload(false);
    })
  };
  return deleteButton;
}
function createDeleteButton ( comment ) { const deleteButton = document . createElement ( 'button' ) ; deleteButton . innerText = 'Delete' ; deleteButton . onclick = function ( ) { const request = new Request ( '/delete-data?commentKey=' + comment . key , { method : 'POST' , } ) ; fetch ( request ) . then ( ( ) => { window . location . reload ( false ) ; } ) } ; return deleteButton ; }
creates a button that will delete given comment on click
creates a button that will delete given comment on click