Route-finder / Frontend

Find and display an optimal route to retrieve books from a library's shelves. Project Frontend
https://route-finder.netlify.app
Mozilla Public License 2.0
0 stars 3 forks source link

Allow searches by Author and Title #23

Closed Isaac-List closed 2 years ago

Isaac-List commented 2 years ago

Is your feature request related to a problem? Please describe. Currently, only ISBN's can be used to search for and add a book to the system, even though we have the UI to take an Author's name and a book's Title as search parameters.

Describe the solution you'd like The Frontend should, given an author and/or a title search term, submit a POST request to the Backend with these search parameters in the following format:

const requestOptions = {
  method: 'POST',
  headers: {
     'Content-Type': 'application/json;charset=utf-8'
  },
  body: JSON.stringify({author: author.value, title: title.value, name: localStorage.getItem('name')})
};

fetch("https://library-guide.herokuapp.com/api/search", requestOptions)
  .then(response => response.json())
  .then(data => 
    /**
     * Perform the relevant actions necessary to display the search suggestions
     * in a readable and accessible format.
     */
    });

NOTE This code is already present in AddBooks.js on lines 50-71. To complete this task, simply replace the contents of lines 62-69 with the code necessary to implement an interface in the style of issue #11. Reference the code example in the text of that issue to get an idea of the expected outcome.

Isaac-List commented 2 years ago

The response returned from the backend will be in this format:

response = [
  {
    author: Author(s) of the work,
    title: Title of the work,
    format: Format of the work (always "Book"),
    code: OCLC "wi" code of the work
  }
  ... other works in the same format
]
Isaac-List commented 2 years ago

Closing this as we do not have time to implement the feature