Skip to content

Commit

Permalink
Updating IntegrationManager so "token-refreshed" events are passed wi…
Browse files Browse the repository at this point in the history
…th a dictionary for consistency.
  • Loading branch information
Samuel Albert committed Jan 2, 2025
1 parent a08f0f2 commit 825abaf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/backend/integrations/integration-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ class IntegrationManager extends TypedEmitter<IntegrationManagerEvents> {
const updatedToken = await authManager.refreshTokenIfExpired(providerId, authData.auth);
if (updatedToken != null) {
this.saveIntegrationAuth(int, updatedToken);
this.emit("token-refreshed", integrationId, updatedToken);
this.emit("token-refreshed", {"integrationId": integrationId, "updatedToken": updatedToken});
}
authData.auth = updatedToken;
} else if (authManager.tokenExpired(providerId, authData.auth)) {
Expand Down Expand Up @@ -423,7 +423,7 @@ class IntegrationManager extends TypedEmitter<IntegrationManagerEvents> {
this.saveIntegrationAuth(int, updatedToken);

authData = updatedToken;
this.emit("token-refreshed", integrationId, updatedToken);
this.emit("token-refreshed", {"integrationId": integrationId, "updatedToken": updatedToken});
}
integrationData.auth = authData;
}
Expand Down
2 changes: 1 addition & 1 deletion src/types/integrations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface IntegrationManagerEvents {
"integrationRegistered": (integration: Integration) => void;
"integration-connected": (integrationId: string) => void;
"integration-disconnected": (integrationId: string) => void;
"token-refreshed": (integrationId: string, updatedToken: AuthDetails) => void;
"token-refreshed": (data: {integrationId: string, updatedToken: AuthDetails}) => void;
}

export declare class IntegrationManager extends TypedEmitter<IntegrationManagerEvents> {
Expand Down

0 comments on commit 825abaf

Please sign in to comment.