Skip to content

Commit

Permalink
fix(auth): update debug error
Browse files Browse the repository at this point in the history
  • Loading branch information
wisley7l committed Mar 11, 2024
1 parent 8697025 commit 72deb33
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 1 addition & 2 deletions functions/lib/bling-auth/create-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ module.exports = (clientId, clientSecret, code, storeId, refreshToken) => new Pr
axios.post(path, params.toString())
.then(({ data }) => resolve(data))
.catch(err => {
console.error(err.response?.data || err)
console.log('Deu erro', JSON.stringify(err))
console.error('Deu erro s:', storeId, ' => ', JSON.stringify(err.response || err))
// console.log('Deu erro quero response status', err.response.status)
if (!isRetry && err.response && err.response.status >= 429) {
setTimeout(() => request(true), 7000)
Expand Down
4 changes: 3 additions & 1 deletion functions/lib/bling-auth/renovate-token.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@ module.exports = async () => {
? maxDocs
: (docs && docs.length) || 0
console.log('max existed docs', maxExistedDocs)
const promises = []
if (maxExistedDocs) {
for (let i = 0; i < maxExistedDocs; i++) {
const docRef = docs[i]
if (docRef.data()?.storeId) {
handleAuth(docRef)
promises.push(handleAuth(docRef))
}
}
}
await Promise.all(promises)
}
}

0 comments on commit 72deb33

Please sign in to comment.