-
-
Save amandeepmittal/6b2c44251cee554b42f7d8aeeae1572c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import axios from 'axios'; | |
export default { | |
// Gets all books | |
getBooks: function() { | |
return axios.get('/api/books'); | |
}, | |
// Gets the book with the given id | |
getBook: function(id) { | |
return axios.get('/api/books/' + id); | |
}, | |
// Deletes the book with the given id | |
deleteBook: function(id) { | |
return axios.delete('/api/books/' + id); | |
}, | |
// Saves a book to the database | |
saveBook: function(bookData) { | |
return axios.post('/api/books', bookData); | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment