Skip to content

Commit

Permalink
(fix) add check for 401 in hejto provider
Browse files Browse the repository at this point in the history
  • Loading branch information
unkn0wn-root committed Mar 18, 2024
1 parent a057d26 commit 5478901
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/lib/hejto/services/hejto-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export class HejtoProvider extends IHejtoProvider {
data: response.data, status: response.status, headers: response.headers
}
} catch (e) {
// 493 means token is probably expired, so get new token and set env to new token
if (e.response?.status === 403) {
// 401 or 403 means token is probably expired, so get new token and set env to new token
if ([401, 403].includes(e.response?.status)) {
const token = await this.refreshToken()
process.env.HEJTO_API_KEY = token.access_token
}
Expand Down

0 comments on commit 5478901

Please sign in to comment.