Skip to content

Commit

Permalink
fix(api): fix issue with status from api not updating, hopefully corr…
Browse files Browse the repository at this point in the history
…ectly this time

re #397

re #397
  • Loading branch information
grivkees committed Jan 14, 2023
1 parent fb9e15d commit a69c702
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions src/infinityApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,12 @@ export class InfinityEvolutionApiConnection {
},
// Failure
error => {
this.log.debug(
`${error.request?.method} ${error.request.host}${error.request?.path}`,
`${error.response.status} ${error.response.statusText}`,
);
this.log.debug(error.response.data);
if (Axios.isAxiosError(error)) {
this.log.debug(
`${error.request?.method} ${error.request?.host}${error.request?.path}`,
`${error.response?.status} ${error.response?.statusText}`,
);
}
return Promise.reject(error); // this makes http errors raise
},
);
Expand All @@ -170,7 +171,7 @@ export class InfinityEvolutionApiConnection {
@MemoizeExpiring(1 * 60 * 1000)
async activate(): Promise<void> {
try {
await this.forceRefreshToken();
await this.forceActivate();
} catch (error) {
this.log.error(
'[API] Failure sending activation signal: ',
Expand All @@ -182,6 +183,7 @@ export class InfinityEvolutionApiConnection {
async forceActivate(): Promise<void> {
await this.axios.post(
`/users/${this.username}/activateSystems`,
null,
{
headers: {
Accept: 'application/json',
Expand Down

0 comments on commit a69c702

Please sign in to comment.