client/src/pages/Books/Books.js
// Then reload books from the database
Then reload books from the database
Then reload books from the database
function handleFormSubmit(event) {
    event.preventDefault();
    if (formObject.title && formObject.author) {
      API.saveBook({
        title: formObject.title,
        author: formObject.author,
        synopsis: formObject.synopsis
      })
        .then(res => {
          formEl.current.reset();
          loadBooks();
        })
        .catch(err => console.log(err));
    }
  }
function handleFormSubmit ( event ) { event . preventDefault ( ) ; if ( formObject . title && formObject . author ) { API . saveBook ( { title : formObject . title , author : formObject . author , synopsis : formObject . synopsis } ) . then ( res => { formEl . current . reset ( ) ; loadBooks ( ) ; } ) . catch ( err => console . log ( err ) ) ; } }
Then reload books from the database
Then reload books from the database