Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): fix issue with status from api not updating, hopefully correctly this time #409

Merged
merged 1 commit into from
Jan 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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