mirror of
https://github.com/bitwarden/browser.git
synced 2025-03-18 14:39:21 +01:00
organization status changed code changes (#12249)
* organization status changed code changes * Remove the stop so a reconnect can be made
This commit is contained in:
parent
903b5c8d93
commit
12b698b11d
@ -243,6 +243,20 @@ export class AppComponent implements OnDestroy, OnInit {
|
||||
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
||||
this.router.navigate(["/remove-password"]);
|
||||
break;
|
||||
case "syncOrganizationStatusChanged": {
|
||||
const { organizationId, enabled } = message;
|
||||
const organizations = await firstValueFrom(this.organizationService.organizations$);
|
||||
const organization = organizations.find((org) => org.id === organizationId);
|
||||
|
||||
if (organization) {
|
||||
const updatedOrganization = {
|
||||
...organization,
|
||||
enabled: enabled,
|
||||
};
|
||||
await this.organizationService.upsert(updatedOrganization);
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
@ -76,7 +76,6 @@ export class AdjustPaymentDialogComponent {
|
||||
}
|
||||
});
|
||||
await response;
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||
this.toastService.showToast({
|
||||
variant: "success",
|
||||
title: null,
|
||||
|
@ -22,4 +22,5 @@ export enum NotificationType {
|
||||
AuthRequestResponse = 16,
|
||||
|
||||
SyncOrganizations = 17,
|
||||
SyncOrganizationStatusChanged = 18,
|
||||
}
|
||||
|
@ -42,6 +42,9 @@ export class NotificationResponse extends BaseResponse {
|
||||
case NotificationType.AuthRequestResponse:
|
||||
this.payload = new AuthRequestPushNotification(payload);
|
||||
break;
|
||||
case NotificationType.SyncOrganizationStatusChanged:
|
||||
this.payload = new OrganizationStatusPushNotification(payload);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -112,3 +115,14 @@ export class AuthRequestPushNotification extends BaseResponse {
|
||||
this.userId = this.getResponseProperty("UserId");
|
||||
}
|
||||
}
|
||||
|
||||
export class OrganizationStatusPushNotification extends BaseResponse {
|
||||
organizationId: string;
|
||||
enabled: boolean;
|
||||
|
||||
constructor(response: any) {
|
||||
super(response);
|
||||
this.organizationId = this.getResponseProperty("OrganizationId");
|
||||
this.enabled = this.getResponseProperty("Enabled");
|
||||
}
|
||||
}
|
||||
|
@ -218,6 +218,11 @@ export class NotificationsService implements NotificationsServiceAbstraction {
|
||||
});
|
||||
}
|
||||
break;
|
||||
case NotificationType.SyncOrganizationStatusChanged:
|
||||
if (isAuthenticated) {
|
||||
await this.syncService.fullSync(true);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user