Skip to content

Commit

Permalink
Merge pull request #134 from mbret/develop
Browse files Browse the repository at this point in the history
feat: added debug
  • Loading branch information
mbret authored May 26, 2024
2 parents 32b2c13 + dabfd01 commit 7908b86
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions packages/api/src/libs/google/googleBooksApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,19 @@ export const findByISBN = async (isbn: string, apiKey: string) => {
}

export const findByTitle = async (name: string, apiKey: string) => {
// @tmp
console.log(`${GOOGLE_BOOK_API_URL}/volumes?q=intitle:${encodeURIComponent(name)}&key=${apiKey}`)
const uri = `${GOOGLE_BOOK_API_URL}/volumes?q=intitle:${encodeURIComponent(name)}&key=${apiKey}`

console.log(uri)

const response = await performWithBackoff({
asyncFunction: () =>
axios.get<GoogleBooksApiResult>(
`${GOOGLE_BOOK_API_URL}/volumes?q=intitle:${encodeURIComponent(name)}&key=${apiKey}`
),
asyncFunction: () => axios.get<GoogleBooksApiResult>(uri),
retry: (error: unknown) => {
// we retry on Too many request error
return isAxiosError(error) && error.response?.status === 429
}
})

console.log(response.data)
if (response.status === 200) {
// Logger.info(`google findByName response`, response.data)

Expand Down

0 comments on commit 7908b86

Please sign in to comment.