user12140833 :
I have a function:
getBooks(page, count, authorId){
return API.get('/books/?page=' +page + '&count='+count+ '&author='+ authorId})
.then(response => {
return response.data
})
}
I am implementing search function and in search I pass only the authorId
i.e
getBooks(akdjh23)
But on doing this it sets akdjh23
to page
. i.e page=akdjh23
but I want authorId=akdjh23
My question is how do I send only authorId
during search and page
and count
on general get request.
Search based on id:
getBooks(id)
Get all books:
get(1, 40) -> page=1, count=40
Mahatmasamatman :
getBooks(null, null, id)
should do the trick. Note that your code won't work as page and count in your function will not be defined.